From f014a44968e30dad8dc946f5182c58b0a7bba006 Mon Sep 17 00:00:00 2001 From: Rick Calixte <10281587+rcalixte@users.noreply.github.com> Date: Sun, 31 Jul 2022 22:16:51 -0400 Subject: [PATCH] cs_keyboard.py, main.js, and windowManager.js: Separate the key bindings and keyboard menu options for switching workspace up/down and toggling window/workspace selection --- .../cinnamon/cinnamon-settings/modules/cs_keyboard.py | 6 ++++-- js/ui/main.js | 8 +++++++- js/ui/windowManager.js | 10 ++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py index 6b3fcec2bf..c4a5637c90 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_keyboard.py @@ -49,8 +49,8 @@ KEYBINDINGS = [ # KB Label Schema Key name Array? Category # General - [_("Show the window selection screen"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-down", "general"], - [_("Show the workspace selection screen"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-up", "general"], + [_("Show the workspace selection screen"), MUFFIN_KEYBINDINGS_SCHEMA, "toggle-workspace-selection", "general"], + [_("Show the window selection screen"), MUFFIN_KEYBINDINGS_SCHEMA, "toggle-window-selection", "general"], [_("Show desktop"), MUFFIN_KEYBINDINGS_SCHEMA, "show-desktop", "general"], [_("Show Desklets"), CINNAMON_SCHEMA, "show-desklets", "general"], [_("Cycle through open windows"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-windows", "general"], @@ -122,6 +122,8 @@ # Workspaces [_("Switch to left workspace"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-left", "workspaces"], [_("Switch to right workspace"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-right", "workspaces"], + [_("Switch to up workspace"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-up", "workspaces"], + [_("Switch to down workspace"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-down", "workspaces"], # Workspaces - Direct Nav [_("Switch to workspace 1"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-1", "ws-navi"], [_("Switch to workspace 2"), MUFFIN_KEYBINDINGS_SCHEMA, "switch-to-workspace-2", "ws-navi"], diff --git a/js/ui/main.js b/js/ui/main.js index dcbf18d38c..2e72cf1f21 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -1134,10 +1134,16 @@ function _stageEventHandler(actor, event) { wm.actionMoveWorkspaceRight(); return true; case Meta.KeyBindingAction.WORKSPACE_UP: + wm.actionMoveWorkspaceUp(); + return true; + case Meta.KeyBindingAction.WORKSPACE_DOWN: + wm.actionMoveWorkspaceDown(); + return true; + case Meta.KeyBindingAction.TOGGLE_WORKSPACE_SELECTION: overview.hide(); expo.hide(); return true; - case Meta.KeyBindingAction.WORKSPACE_DOWN: + case Meta.KeyBindingAction.TOGGLE_WINDOW_SELECTION: overview.hide(); expo.hide(); return true; diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 7d9128b1ef..533987b73a 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -285,6 +285,8 @@ var WindowManager = class WindowManager { this._cinnamonwm.connect('filter-keybinding', this._filterKeybinding.bind(this)); global.window_manager.connect('switch-workspace', (c, f, t, d) => this._switchWorkspace(c, f, t, d)); + Meta.keybindings_set_custom_handler('toggle-window-selection', (d, w, b) => this._showWorkspaceSwitcher(d, w, b)); + Meta.keybindings_set_custom_handler('toggle-workspace-selection', (d, w, b) => this._showWorkspaceSwitcher(d, w, b)); Meta.keybindings_set_custom_handler('move-to-workspace-left', (d, w, b) => this._moveWindowToWorkspaceLeft(d, w, b)); Meta.keybindings_set_custom_handler('move-to-workspace-right', (d, w, b) => this._moveWindowToWorkspaceRight(d, w, b)); @@ -1338,11 +1340,11 @@ var WindowManager = class WindowManager { _showWorkspaceSwitcher(display, window, binding) { let bindingName = binding.get_name(); - if (bindingName === 'switch-to-workspace-up') { + if (bindingName === 'toggle-workspace-selection') { Main.expo.toggle(); return; } - if (bindingName === 'switch-to-workspace-down') { + if (bindingName === 'toggle-window-selection') { Main.overview.toggle(); return; } @@ -1354,6 +1356,10 @@ var WindowManager = class WindowManager { this.actionMoveWorkspaceLeft(); } else if (bindingName === 'switch-to-workspace-right') { this.actionMoveWorkspaceRight(); + } else if (bindingName === 'switch-to-workspace-up') { + this.actionMoveWorkspaceUp(); + } else if (bindingName === 'switch-to-workspace-down') { + this.actionMoveWorkspaceDown(); } }