From 573231b99ab4621d84373854be063662c340045b Mon Sep 17 00:00:00 2001 From: kenji Date: Wed, 24 Dec 2025 00:07:06 +0000 Subject: [PATCH] added workspace binds --- apps/hyprland/hypr/binds.nix | 52 +++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/apps/hyprland/hypr/binds.nix b/apps/hyprland/hypr/binds.nix index 116c4cc..5663df6 100644 --- a/apps/hyprland/hypr/binds.nix +++ b/apps/hyprland/hypr/binds.nix @@ -1,22 +1,44 @@ { wayland.windowManager.hyprland.settings = { - bindd = [ - # essential - "SUPER, Return, Open Terminal, exec, ghostty" # FIXME: must be using xdg-open - "SUPER, Q, Kill active, killactive" + bindd = + [ + # essential + "SUPER, Return, Open Terminal, exec, ghostty" # FIXME: must be using xdg-open + "SUPER, Q, Kill active, killactive" - # move focus - "SUPER, J, Move focus down, movefocus, d" - "SUPER, K, Move focus up, movefocus, u" - "SUPER, H, Move focus left, movefocus, l" - "SUPER, L, Move focus right, movefocus, r" + # move focus + "SUPER, J, Move focus down, movefocus, d" + "SUPER, K, Move focus up, movefocus, u" + "SUPER, H, Move focus left, movefocus, l" + "SUPER, L, Move focus right, movefocus, r" - # fullscreen - "SUPER, F, Toggle Fullscreen, fullscreen, 0" - "SUPER SHIFT, F, Toggle Maximized Fullscreen, fullscreen, 1" + # fullscreen + "SUPER, F, Toggle Fullscreen, fullscreen, 0" + "SUPER SHIFT, F, Toggle Maximized Fullscreen, fullscreen, 1" - # apps - "SUPER, W, Open browser, exec, firefox" # FIXME: must be xdg-open - ]; + # apps + "SUPER, W, Open browser, exec, firefox" # FIXME: must be xdg-open + + # [Workspaces] Toggle between most recent workspaces + "SUPER, Tab, Cycle workspaces, workspace, previous" + ] + ++ ( + # Generate binds for Super + [1-10] to switch workspaces + # and Super + Shift + [1-10] to move window to workspace + builtins.concatLists (builtins.genList ( + i: let + ws = i + 1; + key = toString ( + if ws == 10 + then 0 + else ws + ); + in [ + "SUPER, ${key}, Switch to workspace ${toString ws}, workspace, ${toString ws}" + "SUPER SHIFT, ${key}, Move window to workspace ${toString ws}, movetoworkspace, ${toString ws}" + ] + ) + 10) + ); }; }