From 022267c6f6edf44fc1534639e78f3ec8daebf6ee Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 7 Jul 2022 22:45:04 +0200 Subject: [PATCH] input: Add keybindings for toggling tiling --- config.ron | 8 +++++--- src/config/mod.rs | 2 ++ src/input/mod.rs | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/config.ron b/config.ron index 81b93635..6ba1550f 100644 --- a/config.ron +++ b/config.ron @@ -2,7 +2,7 @@ key_bindings: { (modifiers: [Logo, Shift], key: "Escape"): Terminate, (modifiers: [Logo], key: "Escape"): Debug, - (modifiers: [Logo], key: "Q"): Close, + (modifiers: [Logo], key: "q"): Close, (modifiers: [Logo], key: "1"): Workspace(1), (modifiers: [Logo], key: "2"): Workspace(2), (modifiers: [Logo], key: "3"): Workspace(3), @@ -31,9 +31,11 @@ (modifiers: [Logo], key: "j"): Focus(Down), (modifiers: [Logo], key: "k"): Focus(Up), (modifiers: [Logo], key: "l"): Focus(Right), - //TODO: automatic orientation with Logo+o toggling + //TODO: automatic orientation with Logo+o toggling (modifiers: [Logo], key: "v"): Orientation(Vertical), (modifiers: [Logo], key: "o"): Orientation(Horizontal), + (modifiers: [Logo], key: "y"): ToggleTiling, + (modifiers: [Logo], key: "g"): ToggleWindowFloating, (modifiers: [Logo, Shift], key: "f"): Fullscreen, //TODO: ability to select default web browser (modifiers: [Logo], key: "b"): Spawn("firefox"), @@ -42,7 +44,7 @@ //TODO: ability to select default terminal (modifiers: [Logo], key: "t"): Spawn("gnome-terminal"), (modifiers: [Logo], key: "a"): Spawn("xdg-shell-wrapper cosmic-app-library"), - (modifiers: [Logo], key: "Slash"): Spawn("xdg-shell-wrapper cosmic-launcher"), + (modifiers: [Logo], key: "slash"): Spawn("xdg-shell-wrapper cosmic-launcher"), }, workspace_mode: OutputBound, ) diff --git a/src/config/mod.rs b/src/config/mod.rs index ae244a64..7bbeed5d 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -749,6 +749,8 @@ pub enum Action { MoveToWorkspace(u8), Focus(FocusDirection), Orientation(crate::shell::layout::Orientation), + ToggleTiling, + ToggleWindowFloating, Fullscreen, Spawn(String), } diff --git a/src/input/mod.rs b/src/input/mod.rs index 4c5cd27e..44366427 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -344,6 +344,16 @@ impl State { focus_stack.iter(), ); } + Action::ToggleTiling => { + let output = active_output(seat, &self.common); + let workspace = self.common.shell.active_space_mut(&output); + workspace.toggle_tiling(seat); + } + Action::ToggleWindowFloating => { + let output = active_output(seat, &self.common); + let workspace = self.common.shell.active_space_mut(&output); + workspace.toggle_floating_window(seat); + } Action::Spawn(command) => { if let Err(err) = std::process::Command::new("/bin/sh") .arg("-c")