From 85451e82735f0ba89475f85660c97bf0271ce83c Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Sun, 25 Aug 2024 21:31:14 +0200 Subject: [PATCH] senior overengineer --- modules/gui/hypr/land.nix | 72 ++++++++++++++------------------------- 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/modules/gui/hypr/land.nix b/modules/gui/hypr/land.nix index 7c274ee..d1cb570 100644 --- a/modules/gui/hypr/land.nix +++ b/modules/gui/hypr/land.nix @@ -9,8 +9,9 @@ inherit (config.poz.other.system) username; hmCfg = config.home-manager.users.${username}; + inherit (builtins) toString; inherit (lib.attrsets) attrValues mapAttrsToList; - inherit (lib.lists) elem optionals; + inherit (lib.lists) elem genList map optionals; inherit (lib.meta) getExe getExe'; inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption mkOption; @@ -187,31 +188,17 @@ in { "${name},${w}x${h}@${refresh},${x}x${y},${scale}" ) config.poz.other.hardware.monitors; - workspace = [ + workspace = ( # laptop - "1, monitor:eDP-1, default:true" - "2, monitor:eDP-1" - "3, monitor:eDP-1" - "4, monitor:eDP-1" - "5, monitor:eDP-1" - "6, monitor:eDP-1" - "7, monitor:eDP-1" - "8, monitor:eDP-1" - "9, monitor:eDP-1" - "10, monitor:eDP-1" - + map (i: + "${i}, monitor:eDP-1${optionalString (i == "1") ", default:true"}" + ) (genList (i: toString (i + 1)) 10) + ) ++ ( # second monitor - "11, monitor:HDMI-A-1, default:true" - "12, monitor:HDMI-A-1" - "13, monitor:HDMI-A-1" - "14, monitor:HDMI-A-1" - "15, monitor:HDMI-A-1" - "16, monitor:HDMI-A-1" - "17, monitor:HDMI-A-1" - "18, monitor:HDMI-A-1" - "19, monitor:HDMI-A-1" - "20, monitor:HDMI-A-1" - + map (i: + "${i}, monitor:HDMI-A-1${optionalString (i == "11") ", default:true"}" + ) (genList (i: toString (i + 11)) 10) + ) ++ [ # scratchpads "special:btop, decorate:false" (mkIf isAmdGpuPresent "special:amdgpu_top, decorate:false") @@ -336,7 +323,21 @@ in { (mkIf cfg.tearing "immediate, class:^(osu!)$") ]; - bind = [ + bind = ( + # workspace + map (i: let + key = if i == "10" then "0" else i; + dispatcher = "${optionalString smwPresent "split-"}workspace"; + in "$mainMod, ${key}, ${dispatcher}, ${i}" + ) (genList (i: toString (i + 1)) 10) + ) ++ ( + # movetoworkspacesilent + map (i: let + key = if i == "10" then "0" else i; + dispatcher = "${optionalString smwPresent "split-"}movetoworkspacesilent"; + in "$mainMod SHIFT, ${key}, ${dispatcher}, ${i}" + ) (genList (i: toString (i + 1)) 10) + ) ++ [ "$mainMod, RETURN, exec, ${if config.poz.programs.foot.server then footclient else foot}" "$mainMod, Q, killactive" "$mainMod, F, fullscreen, 0" @@ -346,27 +347,6 @@ in { "$mainMod SHIFT, C, centerwindow" "$mainMod CONTROL, R, bringactivetotop" "$mainMod SHIFT, P, pin" - # workspaces - "$mainMod, 1, ${optionalString smwPresent "split-"}workspace, 1" - "$mainMod, 2, ${optionalString smwPresent "split-"}workspace, 2" - "$mainMod, 3, ${optionalString smwPresent "split-"}workspace, 3" - "$mainMod, 4, ${optionalString smwPresent "split-"}workspace, 4" - "$mainMod, 5, ${optionalString smwPresent "split-"}workspace, 5" - "$mainMod, 6, ${optionalString smwPresent "split-"}workspace, 6" - "$mainMod, 7, ${optionalString smwPresent "split-"}workspace, 7" - "$mainMod, 8, ${optionalString smwPresent "split-"}workspace, 8" - "$mainMod, 9, ${optionalString smwPresent "split-"}workspace, 9" - "$mainMod, 0, ${optionalString smwPresent "split-"}workspace, 10" - "$mainMod SHIFT, 1, ${optionalString smwPresent "split-"}movetoworkspacesilent, 1" - "$mainMod SHIFT, 2, ${optionalString smwPresent "split-"}movetoworkspacesilent, 2" - "$mainMod SHIFT, 3, ${optionalString smwPresent "split-"}movetoworkspacesilent, 3" - "$mainMod SHIFT, 4, ${optionalString smwPresent "split-"}movetoworkspacesilent, 4" - "$mainMod SHIFT, 5, ${optionalString smwPresent "split-"}movetoworkspacesilent, 5" - "$mainMod SHIFT, 6, ${optionalString smwPresent "split-"}movetoworkspacesilent, 6" - "$mainMod SHIFT, 7, ${optionalString smwPresent "split-"}movetoworkspacesilent, 7" - "$mainMod SHIFT, 8, ${optionalString smwPresent "split-"}movetoworkspacesilent, 8" - "$mainMod SHIFT, 9, ${optionalString smwPresent "split-"}movetoworkspacesilent, 9" - "$mainMod SHIFT, 0, ${optionalString smwPresent "split-"}movetoworkspacesilent, 10" "$mainMod, W, exec, ${removeSuffix " %U" hmCfg.xdg.desktopEntries.firefox-schizo.exec}" "$mainMod SHIFT, W, exec, ${removeSuffix " %U" hmCfg.xdg.desktopEntries.firefox-unschizo.exec}" # screenshots