From 1ea3cb3395b00b4e2cdc38ca461705d325140744 Mon Sep 17 00:00:00 2001 From: Frantisek Bohacek <rutherther@proton.me> Date: Sat, 18 Nov 2023 20:04:21 +0100 Subject: [PATCH] refactor: generate workspace keybindings --- modules/desktop/gnome/home.nix | 39 ++++++---------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/modules/desktop/gnome/home.nix b/modules/desktop/gnome/home.nix index 8ab0ed7..9ad33fb 100644 --- a/modules/desktop/gnome/home.nix +++ b/modules/desktop/gnome/home.nix @@ -53,45 +53,20 @@ button-layout = ":minimize,close"; num-workspaces = 9; }; - "org/gnome/shell/keybindings" = { - switch-to-application-1 = ["@as []"]; - switch-to-application-2 = ["@as []"]; - switch-to-application-3 = ["@as []"]; - switch-to-application-4 = ["@as []"]; - switch-to-application-5 = ["@as []"]; - switch-to-application-6 = ["@as []"]; - switch-to-application-7 = ["@as []"]; - switch-to-application-8 = ["@as []"]; - switch-to-application-9 = ["@as []"]; - }; - "org/gnome/desktop/wm/keybindings" = { - switch-to-workspace-1 = ["<Super>1"]; - switch-to-workspace-2 = ["<Super>2"]; - switch-to-workspace-3 = ["<Super>3"]; - switch-to-workspace-4 = ["<Super>4"]; - switch-to-workspace-5 = ["<Super>5"]; - switch-to-workspace-6 = ["<Super>6"]; - switch-to-workspace-7 = ["<Super>7"]; - switch-to-workspace-8 = ["<Super>8"]; - switch-to-workspace-9 = ["<Super>9"]; + # "org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.map (i: { name = "switch-to-application-${i}"; value = ["@as []"]; }) (builtins.genList (y: y + 1) 9)); + "org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.map (i: { name = "switch-to-application-${builtins.toString i}"; value = ["@as []"]; }) (builtins.genList (y: y + 1) 9)); + "org/gnome/desktop/wm/keybindings" = + builtins.listToAttrs (builtins.map (i: { name = "switch-to-workspace-${builtins.toString i}"; value = ["<Super>${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) // + builtins.listToAttrs (builtins.map (i: { name = "move-to-workspace-${builtins.toString i}"; value = ["<Shift><Super>${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) // + { move-to-workspace-left = ["<Super><Shift>a"]; move-to-workspace-right = ["<Super><Shift>d"]; - move-to-workspace-1 = ["<Super><Shift>1"]; - move-to-workspace-2 = ["<Super><Shift>2"]; - move-to-workspace-3 = ["<Super><Shift>3"]; - move-to-workspace-4 = ["<Super><Shift>4"]; - move-to-workspace-5 = ["<Super><Shift>5"]; - move-to-workspace-6 = ["<Super><Shift>6"]; - move-to-workspace-7 = ["<Super><Shift>7"]; - move-to-workspace-8 = ["<Super><Shift>8"]; - move-to-workspace-9 = ["<Super><Shift>9"]; - close = ["<Super>w" "<Alt>F4"]; toggle-fullscreen = ["<Super>f"]; - panel-run-dialog = "<Super>semicolon"; + panel-run-dialog = ["@as []"]; }; "org/gnome/settings-daemon/plugins/power" = { -- 2.48.1