diff --git a/src/config/key_bindings.rs b/src/config/key_bindings.rs index f57e137f..68f644d1 100644 --- a/src/config/key_bindings.rs +++ b/src/config/key_bindings.rs @@ -143,6 +143,8 @@ pub enum Action { Terminate, Debug, Close, + #[serde(skip)] + Escape, Workspace(u8), NextWorkspace, @@ -317,4 +319,11 @@ pub fn add_default_bindings( output_next.iter().copied(), Action::MoveToOutput(output_next_dir), ); + + insert_binding( + key_bindings, + KeyModifiers::default(), + std::iter::once(Keysym::Escape), + Action::Escape, + ); } diff --git a/src/input/mod.rs b/src/input/mod.rs index 86031e18..67774944 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1197,6 +1197,24 @@ impl State { window.send_close(); } } + Action::Escape => { + self.common + .shell + .set_overview_mode(None, self.common.event_loop_handle.clone()); + self.common.shell.set_resize_mode( + None, + &self.common.config, + self.common.event_loop_handle.clone(), + ); + let pointer = seat.get_pointer().unwrap(); + let keyboard = seat.get_keyboard().unwrap(); + if pointer.is_grabbed() { + pointer.unset_grab(self, serial, time); + } + if keyboard.is_grabbed() { + keyboard.unset_grab(); + } + } Action::Workspace(key_num) => { let current_output = seat.active_output(); let workspace = match key_num {