From 1ea3cb3395b00b4e2cdc38ca461705d325140744 Mon Sep 17 00:00:00 2001 From: Frantisek Bohacek 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 = ["1"]; - switch-to-workspace-2 = ["2"]; - switch-to-workspace-3 = ["3"]; - switch-to-workspace-4 = ["4"]; - switch-to-workspace-5 = ["5"]; - switch-to-workspace-6 = ["6"]; - switch-to-workspace-7 = ["7"]; - switch-to-workspace-8 = ["8"]; - switch-to-workspace-9 = ["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 = ["${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) // + builtins.listToAttrs (builtins.map (i: { name = "move-to-workspace-${builtins.toString i}"; value = ["${builtins.toString i}"]; }) (builtins.genList (y: y + 1) 9)) // + { move-to-workspace-left = ["a"]; move-to-workspace-right = ["d"]; - move-to-workspace-1 = ["1"]; - move-to-workspace-2 = ["2"]; - move-to-workspace-3 = ["3"]; - move-to-workspace-4 = ["4"]; - move-to-workspace-5 = ["5"]; - move-to-workspace-6 = ["6"]; - move-to-workspace-7 = ["7"]; - move-to-workspace-8 = ["8"]; - move-to-workspace-9 = ["9"]; - close = ["w" "F4"]; toggle-fullscreen = ["f"]; - panel-run-dialog = "semicolon"; + panel-run-dialog = ["@as []"]; }; "org/gnome/settings-daemon/plugins/power" = { -- 2.49.0