From 27dd1a5716ba9240a70c505439b92f45737cf535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Fri, 30 Jan 2026 17:32:10 +0100 Subject: [PATCH] hyprland: make workspaces host-defined --- home/hosts/gunter/default.nix | 27 +++++++++++++- home/hosts/magicman/default.nix | 15 ++++++++ home/hyprland/default.nix | 63 +++++---------------------------- home/packages/default.nix | 1 + 4 files changed, 51 insertions(+), 55 deletions(-) diff --git a/home/hosts/gunter/default.nix b/home/hosts/gunter/default.nix index 463c9b7..8da9d85 100644 --- a/home/hosts/gunter/default.nix +++ b/home/hosts/gunter/default.nix @@ -59,7 +59,19 @@ hyprland.enableGrimblast = true; hyprland.enableWacom = true; hyprland.cursorNoHardware = true; - hyprland.workspaceStrategy = "named"; + + hyprland.extraWorkspaces = [ + "name:T1, monitor:$mon_top, persistent:true, default:true" + "name:T2, monitor:$mon_top, persistent:true, default:false" + "name:L1, monitor:$mon_left, persistent:true, default:true" + "name:L2, monitor:$mon_left, persistent:true, default:false" + "name:R1, monitor:$mon_right, persistent:true, default:true" + "name:R2, monitor:$mon_right, persistent:true, default:false" + "name:c1, monitor:$mon_center, persistent:true, default:true" + "name:c2, monitor:$mon_center, persistent:true, default:false" + "name:c3, monitor:$mon_center, persistent:true, default:false" + "name:c4, monitor:$mon_center, persistent:true, default:false" + ]; hyprland.monitorVariables = { "$mon_top" = "desc:BNQ G2420HDBL T2B04424SL000"; @@ -80,6 +92,19 @@ "$shiftMainMod,Print,exec,grimblast copy area" ",Print,exec,grimblast copy active" "$mainMod,v,exec,sleep 0.5s && wl-paste | wtype -" + # Workspace keybinds + "$mainMod,1,workspace,name:c1" + "$mainMod,2,workspace,name:c2" + "$mainMod,3,workspace,name:c3" + "$mainMod,4,workspace,name:c4" + "$mainMod,5,workspace,5" + "$mainMod,6,workspace,6" + "$shiftMainMod,1,movetoworkspace,name:c1" + "$shiftMainMod,2,movetoworkspace,name:c2" + "$shiftMainMod,3,movetoworkspace,name:c3" + "$shiftMainMod,4,movetoworkspace,name:c4" + "$shiftMainMod,5,movetoworkspace,5" + "$shiftMainMod,6,movetoworkspace,6" ]; home = { username = "${user}"; diff --git a/home/hosts/magicman/default.nix b/home/hosts/magicman/default.nix index acceb97..174decc 100644 --- a/home/hosts/magicman/default.nix +++ b/home/hosts/magicman/default.nix @@ -38,6 +38,21 @@ tmux.enable = true; hyprland.enable = true; hyprland.monitors = [ "eDP-1,1920x1080@60,0x0,1" ]; + hyprland.extraKeybinds = [ + # Workspace keybinds + "$mainMod,1,workspace,1" + "$mainMod,2,workspace,2" + "$mainMod,3,workspace,3" + "$mainMod,4,workspace,4" + "$mainMod,5,workspace,5" + "$mainMod,6,workspace,6" + "$shiftMainMod,1,movetoworkspace,1" + "$shiftMainMod,2,movetoworkspace,2" + "$shiftMainMod,3,movetoworkspace,3" + "$shiftMainMod,4,movetoworkspace,4" + "$shiftMainMod,5,movetoworkspace,5" + "$shiftMainMod,6,movetoworkspace,6" + ]; home = { username = "${user}"; homeDirectory = "/home/${user}"; diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix index ade5124..0d769b9 100644 --- a/home/hyprland/default.nix +++ b/home/hyprland/default.nix @@ -56,13 +56,14 @@ in description = "Monitor names for hyprlock backgrounds (null for all monitors)"; }; - workspaceStrategy = mkOption { - type = types.enum [ - "numbered" - "named" + extraWorkspaces = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ + "1, monitor:eDP-1, persistent:true, default:true" + "2, monitor:eDP-1, persistent:true" ]; - default = "numbered"; - description = "Workspace naming strategy: numbered (1-6) or named per monitor"; + description = "Extra workspace definitions for Hyprland"; }; monitorVariables = mkOption { @@ -281,22 +282,8 @@ in ]; workspace = - if cfg.workspaceStrategy == "named" then - [ - "name:T1, monitor:$mon_top, persistent:true, default:true" - "name:T2, monitor:$mon_top, persistent:true, default:false" - "name:L1, monitor:$mon_left, persistent:true, default:true" - "name:L2, monitor:$mon_left, persistent:true, default:false" - "name:R1, monitor:$mon_right, persistent:true, default:true" - "name:R2, monitor:$mon_right, persistent:true, default:false" - "name:c1, monitor:$mon_center, persistent:true, default:true" - "name:c2, monitor:$mon_center, persistent:true, default:false" - "name:c3, monitor:$mon_center, persistent:true, default:false" - "name:c4, monitor:$mon_center, persistent:true, default:false" - "special:special, on-created-empty:kitty, rounding:true, decorate:false, border:false" - ] - else - [ "special:special, on-created-empty:kitty, rounding:true, decorate:false, border:false" ]; + [ "special:special, on-created-empty:kitty, rounding:true, decorate:false, border:false" ] + ++ cfg.extraWorkspaces; bindm = [ "$mainMod,mouse:272,movewindow" @@ -335,38 +322,6 @@ in "$shiftMainMod,o,exec, hl-no-opacity" ] ++ cfg.extraKeybinds - ++ ( - if cfg.workspaceStrategy == "numbered" then - [ - "$mainMod,1,workspace,1" - "$mainMod,2,workspace,2" - "$mainMod,3,workspace,3" - "$mainMod,4,workspace,4" - "$mainMod,5,workspace,5" - "$mainMod,6,workspace,6" - "$shiftMainMod,1,movetoworkspace,1" - "$shiftMainMod,2,movetoworkspace,2" - "$shiftMainMod,3,movetoworkspace,3" - "$shiftMainMod,4,movetoworkspace,4" - "$shiftMainMod,5,movetoworkspace,5" - "$shiftMainMod,5,movetoworkspace,6" - ] - else - [ - "$mainMod,1,workspace,name:c1" - "$mainMod,2,workspace,name:c2" - "$mainMod,3,workspace,name:c3" - "$mainMod,4,workspace,name:c4" - "$mainMod,5,workspace,5" - "$mainMod,6,workspace,6" - "$shiftMainMod,1,movetoworkspace,name:c1" - "$shiftMainMod,2,movetoworkspace,name:c2" - "$shiftMainMod,3,movetoworkspace,name:c3" - "$shiftMainMod,4,movetoworkspace,name:c4" - "$shiftMainMod,5,movetoworkspace,5" - "$shiftMainMod,6,movetoworkspace,6" - ] - ) ++ [ # Special workspace "$mainMod,c,togglespecialworkspace" diff --git a/home/packages/default.nix b/home/packages/default.nix index 8c0d68a..d9d9cbe 100644 --- a/home/packages/default.nix +++ b/home/packages/default.nix @@ -13,6 +13,7 @@ in bat bzip2 chromium + claude-code croc devenv distrobox