From 5b8e60d78e91769842fcbed2f3a8b8cbd206be4c Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 3 Aug 2024 23:13:09 -0400 Subject: [PATCH] home/desktop: merge hyprland and sway windowManagerBinds --- .../desktop/hyprland/default.nix | 8 ++-- .../desktop/hyprland/settings.nix | 6 +-- homeManagerModules/desktop/sway/settings.nix | 4 +- homeManagerModules/options.nix | 43 +++++++------------ 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/homeManagerModules/desktop/hyprland/default.nix b/homeManagerModules/desktop/hyprland/default.nix index 62a5fce0..f198ae6b 100644 --- a/homeManagerModules/desktop/hyprland/default.nix +++ b/homeManagerModules/desktop/hyprland/default.nix @@ -14,15 +14,15 @@ in { extraConfig = let moveMonitorBinds = lib.attrsets.mapAttrsToList ( - key: direction: "bind=CONTROL,${key},movecurrentworkspacetomonitor,${direction}" + key: direction: "bind=CONTROL,${key},movecurrentworkspacetomonitor,${builtins.substring 0 1 direction}" ) - cfg.desktop.hyprland.windowManagerBinds; + cfg.desktop.windowManagerBinds; moveWindowBinds = lib.attrsets.mapAttrsToList ( - key: direction: "bind=,${key},movewindow,${direction}" + key: direction: "bind=,${key},movewindow,${builtins.substring 0 1 direction}" ) - cfg.desktop.hyprland.windowManagerBinds; + cfg.desktop.windowManagerBinds; moveWorkspaceBinds = builtins.map (x: "bind=,${toString x},workspace,${toString x}") [1 2 3 4 5 6 7 8 9]; in '' diff --git a/homeManagerModules/desktop/hyprland/settings.nix b/homeManagerModules/desktop/hyprland/settings.nix index f0066d33..26f331ad 100644 --- a/homeManagerModules/desktop/hyprland/settings.nix +++ b/homeManagerModules/desktop/hyprland/settings.nix @@ -56,9 +56,9 @@ in { ] ++ builtins.map (x: "$mod SHIFT,${toString x},movetoworkspace,${toString x}") [1 2 3 4 5 6 7 8 9] ++ builtins.map (x: "$mod,${toString x},workspace,${toString x}") [1 2 3 4 5 6 7 8 9] - ++ lib.attrsets.mapAttrsToList (key: direction: "$mod CONTROL SHIFT,${key},movecurrentworkspacetomonitor,${direction}") cfg.desktop.hyprland.windowManagerBinds - ++ lib.attrsets.mapAttrsToList (key: direction: "$mod SHIFT,${key},movewindow,${direction}") cfg.desktop.hyprland.windowManagerBinds - ++ lib.attrsets.mapAttrsToList (key: direction: "$mod,${key},movefocus,${direction}") cfg.desktop.hyprland.windowManagerBinds; + ++ lib.attrsets.mapAttrsToList (key: direction: "$mod CONTROL SHIFT,${key},movecurrentworkspacetomonitor,${builtins.substring 0 1 direction}") cfg.desktop.windowManagerBinds + ++ lib.attrsets.mapAttrsToList (key: direction: "$mod SHIFT,${key},movewindow,${builtins.substring 0 1 direction}") cfg.desktop.windowManagerBinds + ++ lib.attrsets.mapAttrsToList (key: direction: "$mod,${key},movefocus,${builtins.substring 0 1 direction}") cfg.desktop.windowManagerBinds; bindm = [ # Move/resize windows with mainMod + LMB/RMB and dragging diff --git a/homeManagerModules/desktop/sway/settings.nix b/homeManagerModules/desktop/sway/settings.nix index bae59ed5..629d525e 100644 --- a/homeManagerModules/desktop/sway/settings.nix +++ b/homeManagerModules/desktop/sway/settings.nix @@ -124,7 +124,7 @@ in { "${modifier}+Shift+${key}" = "move ${direction}"; "${modifier}+Control+Shift+${key}" = "move workspace to output ${direction}"; }) - cfg.desktop.sway.windowManagerBinds; + cfg.desktop.windowManagerBinds; modes = { move = @@ -144,7 +144,7 @@ in { ) // lib.attrsets.concatMapAttrs (key: direction: {"${key}" = "move ${direction}";}) - cfg.desktop.sway.windowManagerBinds; + cfg.desktop.windowManagerBinds; resize = { Escape = "mode default"; diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index 3c3a9bdd..496f7d5d 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -131,21 +131,6 @@ in { type = lib.types.listOf lib.types.str; }; - windowManagerBinds = lib.mkOption { - description = "Default binds for window management."; - default = { - down = "d"; - left = "l"; - right = "r"; - up = "u"; - h = "l"; - j = "d"; - k = "u"; - l = "r"; - }; - type = lib.types.attrs; - }; - tabletMode = { enable = lib.mkEnableOption "Tablet mode for hyprland."; @@ -163,21 +148,23 @@ in { default = osConfig.ar.desktop.sway.enable; type = lib.types.bool; }; + }; - windowManagerBinds = lib.mkOption { - description = "Default binds for window management."; - default = { - Down = "down"; - Left = "left"; - Right = "right"; - Up = "up"; - H = "left"; - J = "down"; - K = "up"; - L = "right"; - }; - type = lib.types.attrs; + windowManagerBinds = lib.mkOption { + description = "Default binds for window management."; + + default = { + Down = "down"; + Left = "left"; + Right = "right"; + Up = "up"; + H = "left"; + J = "down"; + K = "up"; + L = "right"; }; + + type = lib.types.attrs; }; };