Modules/Hyprland: Improve special workspace handling + use |> operator
This commit is contained in:
@ -87,18 +87,18 @@
|
|||||||
main-mod = "SUPER";
|
main-mod = "SUPER";
|
||||||
|
|
||||||
bindings = {
|
bindings = {
|
||||||
"$mainMod, T" = ["exec, kitty"];
|
"$mainMod, t" = ["exec, kitty"];
|
||||||
"$mainMod, E" = ["exec, kitty"];
|
"$mainMod, e" = ["exec, kitty"];
|
||||||
"$mainMod, N" = ["exec, neovide"];
|
"$mainMod, n" = ["exec, neovide"];
|
||||||
"$mainMod, R" = ["exec, kitty --class=rmpc --title=Rmpc rmpc"];
|
"$mainMod, r" = ["exec, kitty --title=Rmpc rmpc"];
|
||||||
"$mainMod CTRL, N" = ["exec, kitty --class=navi --title=Navi navi"];
|
"$mainMod CTRL, n" = ["exec, kitty --title=Navi navi"];
|
||||||
"$mainMod SHIFT, N" = ["exec, neovide ${config.paths.dotfiles}/navi/christoph.cheat"];
|
"$mainMod SHIFT, n" = ["exec, neovide ${config.paths.dotfiles}/navi/christoph.cheat"];
|
||||||
"$mainMod SHIFT, F" = ["exec, neovide ${config.paths.dotfiles}/flake.nix"];
|
"$mainMod SHIFT, f" = ["exec, neovide ${config.paths.dotfiles}/flake.nix"];
|
||||||
|
|
||||||
"$mainMod, P" = ["exec, hyprpicker --autocopy --format=hex"];
|
"$mainMod, p" = ["exec, hyprpicker --autocopy --format=hex"];
|
||||||
"$mainMod, S" = ["exec, grim -g \"$(slurp)\""];
|
"$mainMod, s" = ["exec, grim -g \"$(slurp)\""];
|
||||||
"$mainMod CTRL, S" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
|
"$mainMod CTRL, s" = ["exec, grim -g \"$(slurp)\" - | wl-copy"];
|
||||||
"$mainMod SHIFT, 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%+"];
|
", XF86AudioRaiseVolume" = ["exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"];
|
||||||
", XF86AudioLowerVolume" = ["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"];
|
", XF86MonBrightnessDown" = ["exec, hyprctl hyprsunset gamma -10"];
|
||||||
", XF86MonBrightnessUp" = ["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"];
|
"$mainMod, XF86MonBrightnessUp" = ["exec, hyprctl hyprsunset identity"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ws-bindings = {
|
||||||
|
# "<Workspace>" = "<Key>";
|
||||||
|
"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 = {
|
autostart = {
|
||||||
immediate = [
|
immediate = [
|
||||||
];
|
|
||||||
|
|
||||||
delayed = [
|
|
||||||
# "kdeconnect-indicator"
|
|
||||||
"kitty"
|
"kitty"
|
||||||
"nextcloud --background"
|
"nextcloud --background"
|
||||||
|
"protonvpn-app"
|
||||||
"keepassxc"
|
"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 = [];
|
windowrules = [];
|
||||||
|
|
||||||
workspacerules = {
|
workspacerules = {
|
||||||
"special" = [
|
"1" = [];
|
||||||
"ferdium"
|
"2" = ["Zotero" "neovide" "code-url-handler"];
|
||||||
];
|
"3" = ["obsidian" "unityhub" "Unity"];
|
||||||
|
"4" = ["firefox" "Google-chrome" "chromium-browser"];
|
||||||
"2" = [
|
"5" = ["steam"];
|
||||||
"Zotero"
|
"6" = ["steam_app_(.+)"];
|
||||||
|
"7" = ["signal"];
|
||||||
"neovide"
|
"8" = ["Spotify" "rmpc"];
|
||||||
"code-url-handler"
|
"9" = ["discord" "vesktop"];
|
||||||
|
"10" = ["python3"];
|
||||||
# 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"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
floating = [
|
floating = [
|
||||||
@ -211,8 +200,8 @@
|
|||||||
"code-url-handler"
|
"code-url-handler"
|
||||||
"neovide"
|
"neovide"
|
||||||
"steam"
|
"steam"
|
||||||
"rmpc"
|
"ferdium"
|
||||||
"navi"
|
"Msty"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
# TODO: The keys to reset the workspaces need to depend on actual workspace config
|
|
||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
config,
|
config,
|
||||||
@ -10,101 +9,81 @@
|
|||||||
}: let
|
}: let
|
||||||
inherit (config.modules) hyprland color waybar;
|
inherit (config.modules) hyprland color waybar;
|
||||||
|
|
||||||
# This function is mapped to the "cfg.monitors" attrSet.
|
always-bind = lib.mergeAttrsList [
|
||||||
# For each key-value entry in "cfg.monitors",
|
{
|
||||||
# the key will be assigned to "name" and the value to "conf".
|
# Hyprland control
|
||||||
mkMonitor = name: conf: "${name}, ${toString conf.width}x${toString conf.height}@${toString conf.rate}, ${toString conf.x}x${toString conf.y}, ${toString conf.scale}";
|
"$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}";
|
# Move focus with mainMod + arrow keys
|
||||||
mkWorkspaces = monitor: workspace-list: map (mkWorkspace monitor) workspace-list;
|
"$mainMod, h" = ["movefocus, l"];
|
||||||
|
"$mainMod, l" = ["movefocus, r"];
|
||||||
|
"$mainMod, k" = ["movefocus, u"];
|
||||||
|
"$mainMod, j" = ["movefocus, d"];
|
||||||
|
|
||||||
mkWorkspaceRule = workspace: class: "workspace ${workspace}, class:^(${class})$";
|
# Swap windows
|
||||||
mkWorkspaceRules = workspace: class-list: builtins.map (mkWorkspaceRule workspace) class-list;
|
"$mainMod CTRL, h" = ["movewindow, l"];
|
||||||
|
"$mainMod CTRL, l" = ["movewindow, r"];
|
||||||
|
"$mainMod CTRL, k" = ["movewindow, u"];
|
||||||
|
"$mainMod CTRL, d" = ["movewindow, d"];
|
||||||
|
|
||||||
mkFloatingRule = attrs:
|
# Reset workspaces to the defined configuration in hyprland.workspaces:
|
||||||
"float"
|
"CTRL ALT, R" = let
|
||||||
+ (lib.optionalString (builtins.hasAttr "class" attrs) ", class:^(${attrs.class})$")
|
mkWBinding = m: w:
|
||||||
+ (lib.optionalString (builtins.hasAttr "title" attrs) ", title:^(${attrs.title})$");
|
"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})$";
|
# Switch to WS: "$mainMod, 1" = ["workspace, 1"];
|
||||||
|
(let
|
||||||
mkBind = key: action: "${key}, ${action}";
|
mkWBinding = w: k: {"$mainMod, ${k}" = ["workspace, ${w}"];};
|
||||||
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;
|
|
||||||
in
|
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 = {
|
always-bindm = {
|
||||||
"$mainMod, mouse:272" = ["movewindow"];
|
"$mainMod, mouse:272" = ["movewindow"];
|
||||||
@ -114,8 +93,10 @@
|
|||||||
always-exec = builtins.concatLists [
|
always-exec = builtins.concatLists [
|
||||||
(lib.optionals hyprland.dunst.enable ["dunst"]) # Notifications
|
(lib.optionals hyprland.dunst.enable ["dunst"]) # Notifications
|
||||||
[
|
[
|
||||||
|
# Start clipboard management
|
||||||
"wl-paste -t text --watch clipman store --no-persist"
|
"wl-paste -t text --watch clipman store --no-persist"
|
||||||
"wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\""
|
"wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\""
|
||||||
|
|
||||||
"hyprctl setcursor Bibata-Modern-Classic 16"
|
"hyprctl setcursor Bibata-Modern-Classic 16"
|
||||||
"hyprsunset --identity"
|
"hyprsunset --identity"
|
||||||
|
|
||||||
@ -186,15 +167,34 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
file = {
|
file = {
|
||||||
".config/hypr/keybindings.info".text =
|
".config/hypr/keybindings.info".text = let
|
||||||
lib.pipe
|
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)
|
(hyprland.keybindings.bindings // always-bind)
|
||||||
[
|
|> builtins.mapAttrs mkBindsHelp
|
||||||
(builtins.mapAttrs mkBindsHelp)
|
|> builtins.attrValues
|
||||||
builtins.attrValues
|
|> builtins.concatLists
|
||||||
builtins.concatLists
|
|> builtins.concatStringsSep "\n";
|
||||||
(builtins.concatStringsSep "\n")
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -293,11 +293,15 @@ in {
|
|||||||
splash = false;
|
splash = false;
|
||||||
splash_offset = 2.0;
|
splash_offset = 2.0;
|
||||||
|
|
||||||
preload = "~/NixFlake/wallpapers/${hyprland.theme}.png";
|
preload = "${config.paths.nixflake}/wallpapers/${hyprland.theme}.png";
|
||||||
wallpaper = lib.pipe hyprland.monitors [
|
wallpaper = let
|
||||||
builtins.attrNames
|
mkWallpaper = monitor:
|
||||||
(builtins.map mkWallpaper)
|
"${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.
|
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
|
||||||
};
|
};
|
||||||
|
|
||||||
monitor = lib.pipe hyprland.monitors [
|
monitor = let
|
||||||
(builtins.mapAttrs mkMonitor)
|
mkMonitor = name: conf:
|
||||||
builtins.attrValues
|
"${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 [
|
workspace = let
|
||||||
(builtins.mapAttrs mkWorkspaces)
|
mkWorkspace = monitor: workspace:
|
||||||
builtins.attrValues
|
"${builtins.toString workspace}, "
|
||||||
builtins.concatLists
|
+ "monitor:${builtins.toString monitor}";
|
||||||
];
|
|
||||||
|
|
||||||
bind = lib.pipe (hyprland.keybindings.bindings
|
mkWorkspaces = monitor: workspace-list:
|
||||||
// always-bind) [
|
builtins.map (mkWorkspace monitor) workspace-list;
|
||||||
(builtins.mapAttrs mkBinds)
|
in
|
||||||
builtins.attrValues
|
hyprland.workspaces
|
||||||
builtins.concatLists
|
|> builtins.mapAttrs mkWorkspaces
|
||||||
];
|
|> builtins.attrValues
|
||||||
|
|> builtins.concatLists;
|
||||||
|
|
||||||
bindm = lib.pipe always-bindm [
|
bind = let
|
||||||
(builtins.mapAttrs mkBinds)
|
mkBind = key: action: "${key}, ${action}";
|
||||||
builtins.attrValues
|
mkBinds = key: actions: builtins.map (mkBind key) actions;
|
||||||
builtins.concatLists
|
in
|
||||||
];
|
(hyprland.keybindings.bindings // always-bind)
|
||||||
|
|> builtins.mapAttrs mkBinds
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> builtins.concatLists;
|
||||||
|
|
||||||
exec-once = lib.pipe (always-exec ++ hyprland.autostart.immediate ++ delayed-exec) [
|
bindm = let
|
||||||
(builtins.map mkExec)
|
mkBind = key: action: "${key}, ${action}";
|
||||||
];
|
mkBinds = key: actions: builtins.map (mkBind key) actions;
|
||||||
|
in
|
||||||
|
always-bindm
|
||||||
|
|> builtins.mapAttrs mkBinds
|
||||||
|
|> builtins.attrValues
|
||||||
|
|> builtins.concatLists;
|
||||||
|
|
||||||
windowrule =
|
exec-once = let
|
||||||
lib.pipe hyprland.workspacerules [
|
mkDelayedStart = str: ''hyprctl dispatch exec "sleep 5s && ${str}"'';
|
||||||
(builtins.mapAttrs mkWorkspaceRules)
|
|
||||||
builtins.attrValues
|
mkSpecialSilentStart = w: str: "[workspace special:${w} silent] ${str}";
|
||||||
builtins.concatLists
|
mkSpecialSilentStarts = w: strs: builtins.map (mkSpecialSilentStart w) strs;
|
||||||
]
|
in
|
||||||
++ lib.pipe hyprland.floating [
|
lib.mkMerge [
|
||||||
(builtins.map mkFloatingRule)
|
always-exec
|
||||||
]
|
hyprland.autostart.immediate
|
||||||
++ lib.pipe hyprland.transparent [
|
(hyprland.autostart.special-silent
|
||||||
(builtins.map mkTranslucentRule)
|
|> builtins.mapAttrs mkSpecialSilentStarts
|
||||||
]
|
|> builtins.attrValues
|
||||||
++ hyprland.windowrules;
|
|> 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 = {
|
dwindle = {
|
||||||
pseudotile = true;
|
pseudotile = true;
|
||||||
|
@ -2,33 +2,31 @@
|
|||||||
lib,
|
lib,
|
||||||
mylib,
|
mylib,
|
||||||
...
|
...
|
||||||
}:
|
}: {
|
||||||
with lib;
|
enable = lib.mkEnableOption "Hyprland Window Manager + Compositor";
|
||||||
with mylib.modules; {
|
|
||||||
enable = mkEnableOption "Hyprland Window Manager + Compositor";
|
|
||||||
|
|
||||||
kb-layout = mkOption {
|
kb-layout = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
example = "us";
|
example = "us";
|
||||||
description = "Keyboard layout to use";
|
description = "Keyboard layout to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
kb-variant = mkOption {
|
kb-variant = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
example = "altgr-intl";
|
example = "altgr-intl";
|
||||||
description = "Keyboard layout variant";
|
description = "Keyboard layout variant";
|
||||||
};
|
};
|
||||||
|
|
||||||
theme = mkOption {
|
theme = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
example = "Three-Bears";
|
example = "Three-Bears";
|
||||||
description = "Wallpaper and colorscheme to use";
|
description = "Wallpaper and colorscheme to use";
|
||||||
};
|
};
|
||||||
|
|
||||||
dunst.enable = mkEnableOption "Enable dunst notification daemon";
|
dunst.enable = lib.mkEnableOption "Enable dunst notification daemon";
|
||||||
|
|
||||||
monitors = mkOption {
|
monitors = lib.mkOption {
|
||||||
type = types.attrs;
|
type = lib.types.attrs;
|
||||||
description = "Hyprland Monitor Configurations";
|
description = "Hyprland Monitor Configurations";
|
||||||
example = ''
|
example = ''
|
||||||
{
|
{
|
||||||
@ -44,8 +42,8 @@ with mylib.modules; {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
workspaces = mkOption {
|
workspaces = lib.mkOption {
|
||||||
type = types.attrs;
|
type = lib.types.attrs;
|
||||||
description = "How workspaces are distributed to monitors. These monitors will also receive a wallpaper.";
|
description = "How workspaces are distributed to monitors. These monitors will also receive a wallpaper.";
|
||||||
example = ''
|
example = ''
|
||||||
{
|
{
|
||||||
@ -56,8 +54,8 @@ with mylib.modules; {
|
|||||||
};
|
};
|
||||||
|
|
||||||
autostart = {
|
autostart = {
|
||||||
immediate = mkOption {
|
immediate = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = "Programs to launch when Hyprland starts";
|
description = "Programs to launch when Hyprland starts";
|
||||||
example = ''
|
example = ''
|
||||||
[
|
[
|
||||||
@ -67,8 +65,8 @@ with mylib.modules; {
|
|||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
delayed = mkOption {
|
delayed = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
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)";
|
description = "Programs to launch with a delay when Hyprland starts (e.g. to wait for the waybar tray)";
|
||||||
example = ''
|
example = ''
|
||||||
[
|
[
|
||||||
@ -76,11 +74,24 @@ with mylib.modules; {
|
|||||||
"nextcloud --background"
|
"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 {
|
workspacerules = lib.mkOption {
|
||||||
type = types.attrs;
|
type = lib.types.attrs;
|
||||||
description = "Launch programs on specified workspaces, accepts window class.";
|
description = "Launch programs on specified workspaces, accepts window class.";
|
||||||
example = ''
|
example = ''
|
||||||
{
|
{
|
||||||
@ -92,8 +103,8 @@ with mylib.modules; {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
windowrules = mkOption {
|
windowrules = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = "Specify specific window rules.";
|
description = "Specify specific window rules.";
|
||||||
example = ''
|
example = ''
|
||||||
[
|
[
|
||||||
@ -102,14 +113,14 @@ with mylib.modules; {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
transparent-opacity = mkOption {
|
transparent-opacity = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = "The opacity transparent windows should have.";
|
description = "The opacity transparent windows should have.";
|
||||||
example = "0.8";
|
example = "0.8";
|
||||||
};
|
};
|
||||||
|
|
||||||
floating = mkOption {
|
floating = lib.mkOption {
|
||||||
type = types.listOf types.attrs;
|
type = lib.types.listOf lib.types.attrs;
|
||||||
description = "What programs are floating down here?";
|
description = "What programs are floating down here?";
|
||||||
example = ''
|
example = ''
|
||||||
[
|
[
|
||||||
@ -124,8 +135,8 @@ with mylib.modules; {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
transparent = mkOption {
|
transparent = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = "What programs should be transparent? Accepts window class.";
|
description = "What programs should be transparent? Accepts window class.";
|
||||||
example = ''
|
example = ''
|
||||||
[
|
[
|
||||||
@ -135,8 +146,8 @@ with mylib.modules; {
|
|||||||
};
|
};
|
||||||
|
|
||||||
keybindings = {
|
keybindings = {
|
||||||
main-mod = mkOption {
|
main-mod = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = "Main modifier key";
|
description = "Main modifier key";
|
||||||
example = ''
|
example = ''
|
||||||
"SUPER"
|
"SUPER"
|
||||||
@ -144,8 +155,8 @@ with mylib.modules; {
|
|||||||
default = "SUPER";
|
default = "SUPER";
|
||||||
};
|
};
|
||||||
|
|
||||||
bindings = mkOption {
|
bindings = lib.mkOption {
|
||||||
type = types.attrs;
|
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
|
||||||
description = "Hyprland keyboard shortcuts";
|
description = "Hyprland keyboard shortcuts";
|
||||||
default = {};
|
default = {};
|
||||||
example = ''
|
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 = ''
|
||||||
|
{
|
||||||
|
# "<Workspace>" = "<Key>";
|
||||||
|
"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 = ''
|
||||||
|
{
|
||||||
|
# "<Workspace>" = "<Key>";
|
||||||
|
"ferdium" = "x";
|
||||||
|
"btop" = "b";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user