From d28f6a5be4aff21dad8a7c04969adc4b11f56641 Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Mon, 14 Jul 2025 22:06:48 +0200 Subject: [PATCH] Modules/Hyprland: Improve special workspace handling + use |> operator --- home/christoph/default.nix | 129 ++++++------ home/modules/hyprland/default.nix | 330 +++++++++++++++++------------- home/modules/hyprland/options.nix | 103 +++++++--- 3 files changed, 319 insertions(+), 243 deletions(-) diff --git a/home/christoph/default.nix b/home/christoph/default.nix index 07632ce6..c8f32b5a 100644 --- a/home/christoph/default.nix +++ b/home/christoph/default.nix @@ -87,18 +87,18 @@ main-mod = "SUPER"; bindings = { - "$mainMod, T" = ["exec, kitty"]; - "$mainMod, E" = ["exec, kitty"]; - "$mainMod, N" = ["exec, neovide"]; - "$mainMod, R" = ["exec, kitty --class=rmpc --title=Rmpc rmpc"]; - "$mainMod CTRL, N" = ["exec, kitty --class=navi --title=Navi navi"]; - "$mainMod SHIFT, N" = ["exec, neovide ${config.paths.dotfiles}/navi/christoph.cheat"]; - "$mainMod SHIFT, F" = ["exec, neovide ${config.paths.dotfiles}/flake.nix"]; + "$mainMod, t" = ["exec, kitty"]; + "$mainMod, e" = ["exec, kitty"]; + "$mainMod, n" = ["exec, neovide"]; + "$mainMod, r" = ["exec, kitty --title=Rmpc rmpc"]; + "$mainMod CTRL, n" = ["exec, kitty --title=Navi navi"]; + "$mainMod SHIFT, n" = ["exec, neovide ${config.paths.dotfiles}/navi/christoph.cheat"]; + "$mainMod SHIFT, f" = ["exec, neovide ${config.paths.dotfiles}/flake.nix"]; - "$mainMod, P" = ["exec, hyprpicker --autocopy --format=hex"]; - "$mainMod, S" = ["exec, grim -g \"$(slurp)\""]; - "$mainMod CTRL, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"]; - "$mainMod SHIFT, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"]; + "$mainMod, p" = ["exec, hyprpicker --autocopy --format=hex"]; + "$mainMod, s" = ["exec, grim -g \"$(slurp)\""]; + "$mainMod CTRL, s" = ["exec, grim -g \"$(slurp)\" - | wl-copy"]; + "$mainMod SHIFT, s" = ["exec, grim -g \"$(slurp)\" - | wl-copy"]; ", XF86AudioRaiseVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"]; ", XF86AudioLowerVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"]; @@ -108,78 +108,67 @@ ", XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset gamma -10"]; ", XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset gamma +10"]; - "$mainMod, XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset temperature 6000"]; + "$mainMod, XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset temperature 5750"]; "$mainMod, XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset identity"]; }; + + ws-bindings = { + # "" = ""; + "1" = "1"; + "2" = "2"; + "3" = "3"; + "4" = "4"; + "5" = "5"; + "6" = "6"; + "7" = "7"; + "8" = "8"; + "9" = "9"; + "10" = "0"; + }; + + special-ws-bindings = { + "ferdium" = "x"; + "msty" = "z"; + "btop" = "b"; + "rmcp" = "r"; + "yazi" = "y"; + }; }; autostart = { immediate = [ - ]; - - delayed = [ - # "kdeconnect-indicator" "kitty" "nextcloud --background" + "protonvpn-app" "keepassxc" - "ferdium" + + # "kdeconnect-indicator" # started by services.kdeconnect.indicator ]; + + special-silent = { + "ferdium" = ["ferdium"]; + "msty" = ["msty"]; + "btop" = ["kitty --title=Btop btop"]; + "yazi" = ["kitty --title=Yazi yazi"]; + "rmcp" = ["kitty --title=Rmcp rmcp"]; + }; + + delayed = []; }; windowrules = []; workspacerules = { - "special" = [ - "ferdium" - ]; - - "2" = [ - "Zotero" - - "neovide" - "code-url-handler" - - # NOTE: Pinning Jetbrains IDEs to a workspace prevents them from being on any other :( - # "jetbrains-clion" - # "jetbrains-idea" - # "jetbrains-pycharm" - # "jetbrains-rustrover" - # "jetbrains-rider" - # "jetbrains-webstorm" - ]; - "3" = [ - "obsidian" - - "unityhub" - "Unity" - ]; - "4" = [ - "firefox" - "Google-chrome" - "chromium-browser" - ]; - "5" = [ - "steam" - ]; - "6" = [ - # Should match all steam games - "steam_app_(.+)" - ]; - "7" = [ - "signal" - ]; - "8" = [ - "Spotify" - "rmpc" - ]; - "9" = [ - "discord" - "vesktop" - ]; - - "10" = [ - "python3" - ]; + "1" = []; + "2" = ["Zotero" "neovide" "code-url-handler"]; + "3" = ["obsidian" "unityhub" "Unity"]; + "4" = ["firefox" "Google-chrome" "chromium-browser"]; + "5" = ["steam"]; + "6" = ["steam_app_(.+)"]; + "7" = ["signal"]; + "8" = ["Spotify" "rmpc"]; + "9" = ["discord" "vesktop"]; + "10" = ["python3"]; }; floating = [ @@ -211,8 +200,8 @@ "code-url-handler" "neovide" "steam" - "rmpc" - "navi" + "ferdium" + "Msty" ]; }; diff --git a/home/modules/hyprland/default.nix b/home/modules/hyprland/default.nix index b301a20c..d22fa04f 100644 --- a/home/modules/hyprland/default.nix +++ b/home/modules/hyprland/default.nix @@ -1,4 +1,3 @@ -# TODO: The keys to reset the workspaces need to depend on actual workspace config { inputs, config, @@ -10,101 +9,81 @@ }: let inherit (config.modules) hyprland color waybar; - # This function is mapped to the "cfg.monitors" attrSet. - # For each key-value entry in "cfg.monitors", - # the key will be assigned to "name" and the value to "conf". - mkMonitor = name: conf: "${name}, ${toString conf.width}x${toString conf.height}@${toString conf.rate}, ${toString conf.x}x${toString conf.y}, ${toString conf.scale}"; + always-bind = lib.mergeAttrsList [ + { + # Hyprland control + "$mainMod, a" = ["exec, rofi -drun-show-actions -show drun"]; + "$mainMod, q" = ["killactive"]; + "$mainMod, v" = ["togglefloating"]; + "$mainMod, f" = ["fullscreen"]; + "$mainMod, c" = ["exec, clipman pick --tool=rofi"]; + "$mainMod SHIFT, l" = ["exec, loginctl lock-session"]; + "$mainMod, tab" = ["workspace, previous"]; + "ALT, tab" = ["exec, rofi -show window"]; + # "$mainMod, g" = ["togglegroup"]; + # "ALT, tab" = ["changegroupactive"]; - mkWorkspace = monitor: workspace: "${toString workspace}, monitor:${toString monitor}"; - mkWorkspaces = monitor: workspace-list: map (mkWorkspace monitor) workspace-list; + # Move focus with mainMod + arrow keys + "$mainMod, h" = ["movefocus, l"]; + "$mainMod, l" = ["movefocus, r"]; + "$mainMod, k" = ["movefocus, u"]; + "$mainMod, j" = ["movefocus, d"]; - mkWorkspaceRule = workspace: class: "workspace ${workspace}, class:^(${class})$"; - mkWorkspaceRules = workspace: class-list: builtins.map (mkWorkspaceRule workspace) class-list; + # Swap windows + "$mainMod CTRL, h" = ["movewindow, l"]; + "$mainMod CTRL, l" = ["movewindow, r"]; + "$mainMod CTRL, k" = ["movewindow, u"]; + "$mainMod CTRL, d" = ["movewindow, d"]; - mkFloatingRule = attrs: - "float" - + (lib.optionalString (builtins.hasAttr "class" attrs) ", class:^(${attrs.class})$") - + (lib.optionalString (builtins.hasAttr "title" attrs) ", title:^(${attrs.title})$"); + # Reset workspaces to the defined configuration in hyprland.workspaces: + "CTRL ALT, R" = let + mkWBinding = m: w: + "moveworkspacetomonitor, " + + "${builtins.toString w} ${builtins.toString m}"; + mkWsBindings = m: ws: builtins.map (mkWBinding m) ws; + in + hyprland.workspaces + |> builtins.mapAttrs mkWsBindings + |> builtins.attrValues + |> builtins.concatLists; + } - mkTranslucentRule = class: "opacity ${hyprland.transparent-opacity} ${hyprland.transparent-opacity}, class:^(${class})$"; - - mkBind = key: action: "${key}, ${action}"; - mkBinds = key: actions: builtins.map (mkBind key) actions; - - # These functions are used to generate the keybindings.info file for Rofi - fixupNoMod = key: ''${builtins.replaceStrings ["<-"] ["<"] key}''; - mkBindHelpKey = key: ''${builtins.replaceStrings ["$mainMod" " " ","] ["${hyprland.keybindings.main-mod}" "-" ""] key}''; - mkBindHelpAction = action: ''${builtins.replaceStrings [","] [""] action}''; - mkBindHelp = key: action: "<${mkBindHelpKey key}>: ${mkBindHelpAction action}"; - mkBindsHelp = key: actions: builtins.map fixupNoMod (builtins.map (mkBindHelp key) actions); - - mkWallpaper = monitor: "${monitor}, ${config.home.homeDirectory}/NixFlake/wallpapers/${hyprland.theme}.png"; - - mkDelayedStart = str: "hyprctl dispatch exec \"sleep 5s && ${str}\""; - delayed-exec = builtins.map mkDelayedStart hyprland.autostart.delayed; - mkExec = prog: "${prog}"; - - always-bind = { - # Hyprland control - "$mainMod, A" = ["exec, rofi -drun-show-actions -show drun"]; - "$mainMod, Q" = ["killactive"]; - "$mainMod, V" = ["togglefloating"]; - "$mainMod, F" = ["fullscreen"]; - "$mainMod, C" = ["exec, clipman pick --tool=rofi"]; - "$mainMod, G" = ["togglegroup"]; - "$mainMod, L" = ["exec, loginctl lock-session"]; - "ALT, tab" = ["changegroupactive"]; - "$mainMod, tab" = ["workspace, previous"]; - - # Move focus with mainMod + arrow keys - "$mainMod, h" = ["movefocus, l"]; - "$mainMod, l" = ["movefocus, r"]; - "$mainMod, k" = ["movefocus, u"]; - "$mainMod, j" = ["movefocus, d"]; - - # Swap windows - "$mainMod CTRL, h" = ["movewindow, l"]; - "$mainMod CTRL, l" = ["movewindow, r"]; - "$mainMod CTRL, k" = ["movewindow, u"]; - "$mainMod CTRL, d" = ["movewindow, d"]; - - # TODO: Somehow write this more compact? Try to use workspace 0 instead of 10... - "$mainMod, 1" = ["workspace, 1"]; - "$mainMod, 2" = ["workspace, 2"]; - "$mainMod, 3" = ["workspace, 3"]; - "$mainMod, 4" = ["workspace, 4"]; - "$mainMod, 5" = ["workspace, 5"]; - "$mainMod, 6" = ["workspace, 6"]; - "$mainMod, 7" = ["workspace, 7"]; - "$mainMod, 8" = ["workspace, 8"]; - "$mainMod, 9" = ["workspace, 9"]; - "$mainMod, 0" = ["workspace, 10"]; - "$mainMod, x" = ["togglespecialworkspace"]; - - "$mainMod SHIFT, 1" = ["movetoworkspace, 1"]; - "$mainMod SHIFT, 2" = ["movetoworkspace, 2"]; - "$mainMod SHIFT, 3" = ["movetoworkspace, 3"]; - "$mainMod SHIFT, 4" = ["movetoworkspace, 4"]; - "$mainMod SHIFT, 5" = ["movetoworkspace, 5"]; - "$mainMod SHIFT, 6" = ["movetoworkspace, 6"]; - "$mainMod SHIFT, 7" = ["movetoworkspace, 7"]; - "$mainMod SHIFT, 8" = ["movetoworkspace, 8"]; - "$mainMod SHIFT, 9" = ["movetoworkspace, 9"]; - "$mainMod SHIFT, 0" = ["movetoworkspace, 10"]; - "$mainMod SHIFT, x" = ["movetoworkspace, special"]; - - # Reset workspaces to the defined configuration in hyprland.workspaces: - # [ - # "moveworkspacetomonitor, 1 HDMI-A-1" - # "moveworkspacetomonitor, 2 HDMI-A-1" - # ... - # ] - "CTRL ALT, R" = let - mkWorkspaceBinding = monitor: workspace: "moveworkspacetomonitor, ${builtins.toString workspace} ${builtins.toString monitor}"; - mkWorkspacesBindings = monitor: workspaces: builtins.map (mkWorkspaceBinding monitor) workspaces; + # Switch to WS: "$mainMod, 1" = ["workspace, 1"]; + (let + mkWBinding = w: k: {"$mainMod, ${k}" = ["workspace, ${w}"];}; in - builtins.concatLists (builtins.attrValues (builtins.mapAttrs mkWorkspacesBindings hyprland.workspaces)); - }; + hyprland.keybindings.ws-bindings + |> builtins.mapAttrs mkWBinding + |> builtins.attrValues + |> lib.mergeAttrsList) + + # Toggle special WS: "$mainMod, x" = ["togglespecialworkspace, ferdium"]; + (let + mkSpecialWBinding = w: k: {"$mainMod, ${k}" = ["togglespecialworkspace, ${w}"];}; + in + hyprland.keybindings.special-ws-bindings + |> builtins.mapAttrs mkSpecialWBinding + |> builtins.attrValues + |> lib.mergeAttrsList) + + # Move to WS: "$mainMod SHIFT, 1" = ["movetoworkspace, 1"]; + (let + mkMoveWBinding = w: k: {"$mainMod SHIFT, ${k}" = ["movetoworkspace, ${w}"];}; + in + (hyprland.keybindings.ws-bindings) + |> builtins.mapAttrs mkMoveWBinding + |> builtins.attrValues + |> lib.mergeAttrsList) + + # Move to special WS: "$mainMod SHIFT, x" = ["movetoworkspace, special:ferdium"]; + (let + mkSpecialMoveWBinding = w: k: {"$mainMod SHIFT, ${k}" = ["movetoworkspace, special:${w}"];}; + in + (hyprland.keybindings.special-ws-bindings) + |> builtins.mapAttrs mkSpecialMoveWBinding + |> builtins.attrValues + |> lib.mergeAttrsList) + ]; always-bindm = { "$mainMod, mouse:272" = ["movewindow"]; @@ -114,8 +93,10 @@ always-exec = builtins.concatLists [ (lib.optionals hyprland.dunst.enable ["dunst"]) # Notifications [ + # Start clipboard management "wl-paste -t text --watch clipman store --no-persist" "wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\"" + "hyprctl setcursor Bibata-Modern-Classic 16" "hyprsunset --identity" @@ -186,15 +167,34 @@ in { ]; file = { - ".config/hypr/keybindings.info".text = - lib.pipe + ".config/hypr/keybindings.info".text = let + fixupNoMod = key: ''${builtins.replaceStrings + ["<-"] + ["<"] + key}''; + + mkBindHelpKey = key: ''${builtins.replaceStrings + ["$mainMod" " " ","] + ["${hyprland.keybindings.main-mod}" "-" ""] + key}''; + + mkBindHelpAction = action: ''${builtins.replaceStrings + [","] + [""] + action}''; + + mkBindHelp = key: action: "<${mkBindHelpKey key}>: ${mkBindHelpAction action}"; + + mkBindsHelp = key: actions: + actions + |> builtins.map (mkBindHelp key) + |> builtins.map fixupNoMod; + in (hyprland.keybindings.bindings // always-bind) - [ - (builtins.mapAttrs mkBindsHelp) - builtins.attrValues - builtins.concatLists - (builtins.concatStringsSep "\n") - ]; + |> builtins.mapAttrs mkBindsHelp + |> builtins.attrValues + |> builtins.concatLists + |> builtins.concatStringsSep "\n"; }; }; @@ -293,11 +293,15 @@ in { splash = false; splash_offset = 2.0; - preload = "~/NixFlake/wallpapers/${hyprland.theme}.png"; - wallpaper = lib.pipe hyprland.monitors [ - builtins.attrNames - (builtins.map mkWallpaper) - ]; + preload = "${config.paths.nixflake}/wallpapers/${hyprland.theme}.png"; + wallpaper = let + mkWallpaper = monitor: + "${monitor}, " + + "${config.paths.nixflake}/wallpapers/${hyprland.theme}.png"; + in + hyprland.monitors + |> builtins.attrNames + |> builtins.map mkWallpaper; }; }; @@ -417,47 +421,93 @@ in { sensitivity = 0; # -1.0 - 1.0, 0 means no modification. }; - monitor = lib.pipe hyprland.monitors [ - (builtins.mapAttrs mkMonitor) - builtins.attrValues - ]; + monitor = let + mkMonitor = name: conf: + "${name}, " + + "${builtins.toString conf.width}x${builtins.toString conf.height}@" + + "${builtins.toString conf.rate}, " + + "${builtins.toString conf.x}x${builtins.toString conf.y}, " + + "${builtins.toString conf.scale}"; + in + hyprland.monitors + |> builtins.mapAttrs mkMonitor + |> builtins.attrValues; - workspace = lib.pipe hyprland.workspaces [ - (builtins.mapAttrs mkWorkspaces) - builtins.attrValues - builtins.concatLists - ]; + workspace = let + mkWorkspace = monitor: workspace: + "${builtins.toString workspace}, " + + "monitor:${builtins.toString monitor}"; - bind = lib.pipe (hyprland.keybindings.bindings - // always-bind) [ - (builtins.mapAttrs mkBinds) - builtins.attrValues - builtins.concatLists - ]; + mkWorkspaces = monitor: workspace-list: + builtins.map (mkWorkspace monitor) workspace-list; + in + hyprland.workspaces + |> builtins.mapAttrs mkWorkspaces + |> builtins.attrValues + |> builtins.concatLists; - bindm = lib.pipe always-bindm [ - (builtins.mapAttrs mkBinds) - builtins.attrValues - builtins.concatLists - ]; + bind = let + mkBind = key: action: "${key}, ${action}"; + mkBinds = key: actions: builtins.map (mkBind key) actions; + in + (hyprland.keybindings.bindings // always-bind) + |> builtins.mapAttrs mkBinds + |> builtins.attrValues + |> builtins.concatLists; - exec-once = lib.pipe (always-exec ++ hyprland.autostart.immediate ++ delayed-exec) [ - (builtins.map mkExec) - ]; + bindm = let + mkBind = key: action: "${key}, ${action}"; + mkBinds = key: actions: builtins.map (mkBind key) actions; + in + always-bindm + |> builtins.mapAttrs mkBinds + |> builtins.attrValues + |> builtins.concatLists; - windowrule = - lib.pipe hyprland.workspacerules [ - (builtins.mapAttrs mkWorkspaceRules) - builtins.attrValues - builtins.concatLists - ] - ++ lib.pipe hyprland.floating [ - (builtins.map mkFloatingRule) - ] - ++ lib.pipe hyprland.transparent [ - (builtins.map mkTranslucentRule) - ] - ++ hyprland.windowrules; + exec-once = let + mkDelayedStart = str: ''hyprctl dispatch exec "sleep 5s && ${str}"''; + + mkSpecialSilentStart = w: str: "[workspace special:${w} silent] ${str}"; + mkSpecialSilentStarts = w: strs: builtins.map (mkSpecialSilentStart w) strs; + in + lib.mkMerge [ + always-exec + hyprland.autostart.immediate + (hyprland.autostart.special-silent + |> builtins.mapAttrs mkSpecialSilentStarts + |> builtins.attrValues + |> builtins.concatLists) + (hyprland.autostart.delayed + |> builtins.map mkDelayedStart) + ]; + + windowrule = let + mkWorkspaceRule = workspace: class: + "workspace ${workspace}, " + + "class:^(${class})$"; + mkWorkspaceRules = workspace: class-list: + builtins.map (mkWorkspaceRule workspace) class-list; + + mkFloatingRule = attrs: + "float" + + (lib.optionalString (builtins.hasAttr "class" attrs) ", class:^(${attrs.class})$") + + (lib.optionalString (builtins.hasAttr "title" attrs) ", title:^(${attrs.title})$"); + + mkTranslucentRule = class: + "opacity ${hyprland.transparent-opacity} ${hyprland.transparent-opacity}, " + + "class:^(${class})$"; + in + lib.mkMerge [ + (hyprland.workspacerules + |> builtins.mapAttrs mkWorkspaceRules + |> builtins.attrValues + |> builtins.concatLists) + (hyprland.floating + |> builtins.map mkFloatingRule) + (hyprland.transparent + |> builtins.map mkTranslucentRule) + hyprland.windowrules + ]; dwindle = { pseudotile = true; diff --git a/home/modules/hyprland/options.nix b/home/modules/hyprland/options.nix index 5329d017..44fd6051 100644 --- a/home/modules/hyprland/options.nix +++ b/home/modules/hyprland/options.nix @@ -2,33 +2,31 @@ lib, mylib, ... -}: -with lib; -with mylib.modules; { - enable = mkEnableOption "Hyprland Window Manager + Compositor"; +}: { + enable = lib.mkEnableOption "Hyprland Window Manager + Compositor"; - kb-layout = mkOption { - type = types.str; + kb-layout = lib.mkOption { + type = lib.types.str; example = "us"; description = "Keyboard layout to use"; }; - kb-variant = mkOption { - type = types.str; + kb-variant = lib.mkOption { + type = lib.types.str; example = "altgr-intl"; description = "Keyboard layout variant"; }; - theme = mkOption { - type = types.str; + theme = lib.mkOption { + type = lib.types.str; example = "Three-Bears"; description = "Wallpaper and colorscheme to use"; }; - dunst.enable = mkEnableOption "Enable dunst notification daemon"; + dunst.enable = lib.mkEnableOption "Enable dunst notification daemon"; - monitors = mkOption { - type = types.attrs; + monitors = lib.mkOption { + type = lib.types.attrs; description = "Hyprland Monitor Configurations"; example = '' { @@ -44,8 +42,8 @@ with mylib.modules; { ''; }; - workspaces = mkOption { - type = types.attrs; + workspaces = lib.mkOption { + type = lib.types.attrs; description = "How workspaces are distributed to monitors. These monitors will also receive a wallpaper."; example = '' { @@ -56,8 +54,8 @@ with mylib.modules; { }; autostart = { - immediate = mkOption { - type = types.listOf types.str; + immediate = lib.mkOption { + type = lib.types.listOf lib.types.str; description = "Programs to launch when Hyprland starts"; example = '' [ @@ -67,8 +65,8 @@ with mylib.modules; { default = []; }; - delayed = mkOption { - type = types.listOf types.str; + delayed = lib.mkOption { + type = lib.types.listOf lib.types.str; description = "Programs to launch with a delay when Hyprland starts (e.g. to wait for the waybar tray)"; example = '' [ @@ -76,11 +74,24 @@ with mylib.modules; { "nextcloud --background" ] ''; + default = []; + }; + + special-silent = lib.mkOption { + type = lib.types.attrsOf (lib.types.listOf lib.types.str); + description = "Programs to silently launch on special workspaces"; + example = '' + { + "ferdium" = ["ferdium"]; + "btop" = ["kitty --title=Btop btop"]; + } + ''; + default = {}; }; }; - workspacerules = mkOption { - type = types.attrs; + workspacerules = lib.mkOption { + type = lib.types.attrs; description = "Launch programs on specified workspaces, accepts window class."; example = '' { @@ -92,8 +103,8 @@ with mylib.modules; { ''; }; - windowrules = mkOption { - type = types.listOf types.str; + windowrules = lib.mkOption { + type = lib.types.listOf lib.types.str; description = "Specify specific window rules."; example = '' [ @@ -102,14 +113,14 @@ with mylib.modules; { ''; }; - transparent-opacity = mkOption { - type = types.str; + transparent-opacity = lib.mkOption { + type = lib.types.str; description = "The opacity transparent windows should have."; example = "0.8"; }; - floating = mkOption { - type = types.listOf types.attrs; + floating = lib.mkOption { + type = lib.types.listOf lib.types.attrs; description = "What programs are floating down here?"; example = '' [ @@ -124,8 +135,8 @@ with mylib.modules; { ''; }; - transparent = mkOption { - type = types.listOf types.str; + transparent = lib.mkOption { + type = lib.types.listOf lib.types.str; description = "What programs should be transparent? Accepts window class."; example = '' [ @@ -135,8 +146,8 @@ with mylib.modules; { }; keybindings = { - main-mod = mkOption { - type = types.str; + main-mod = lib.mkOption { + type = lib.types.str; description = "Main modifier key"; example = '' "SUPER" @@ -144,8 +155,8 @@ with mylib.modules; { default = "SUPER"; }; - bindings = mkOption { - type = types.attrs; + bindings = lib.mkOption { + type = lib.types.attrsOf (lib.types.listOf lib.types.str); description = "Hyprland keyboard shortcuts"; default = {}; example = '' @@ -157,5 +168,31 @@ with mylib.modules; { } ''; }; + + ws-bindings = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + description = "Map keys to workspaces"; + default = {}; + example = '' + { + # "" = ""; + "1" = "1"; + "10" = "0"; + } + ''; + }; + + special-ws-bindings = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + description = "Map keys to special (scratchpad) workspaces"; + default = {}; + example = '' + { + # "" = ""; + "ferdium" = "x"; + "btop" = "b"; + } + ''; + }; }; }