home/hyprland: nixify extraConfig
Some checks failed
nix-build / default-build (push) Has been cancelled
nix-build / fallarbor-build (push) Has been cancelled
nix-build / lavaridge-build (push) Has been cancelled
nix-build / mauville-build (push) Has been cancelled
nix-build / petalburg-build (push) Has been cancelled
nix-build / rustboro-build (push) Has been cancelled
nix-check / fmt-check (push) Has been cancelled
nix-check / eval-check (push) Has been cancelled

This commit is contained in:
Aly Raffauf 2024-07-19 13:40:36 -04:00
parent cdcce3d885
commit 09cea45f8e

View file

@ -9,10 +9,23 @@ in {
config = lib.mkIf cfg.desktop.hyprland.enable {
wayland.windowManager.hyprland = {
enable = true;
settings =
import ./settings.nix {inherit config lib pkgs;};
settings = import ./settings.nix {inherit config lib pkgs;};
extraConfig = ''
extraConfig = let
moveMonitorBinds =
lib.attrsets.mapAttrsToList (
key: direction: "bind=CONTROL,${key},movecurrentworkspacetomonitor,${direction}"
)
cfg.desktop.hyprland.windowManagerBinds;
moveWindowBinds =
lib.attrsets.mapAttrsToList (
key: direction: "bind=,${key},movewindow,${direction}"
)
cfg.desktop.hyprland.windowManagerBinds;
moveWorkspaceBinds = builtins.map (x: "bind=,${toString x},workspace,${toString x}") [1 2 3 4 5 6 7 8 9];
in ''
submap=resize
binde=,down,resizeactive,0 10
binde=,left,resizeactive,-10 0
@ -26,27 +39,9 @@ in {
submap=reset
submap=move
# Move window with keys ++
# Move workspaces across monitors with CONTROL + keys.
${
lib.strings.concatLines
(
lib.attrsets.mapAttrsToList (key: direction: ''
bind = , ${key}, movewindow, ${direction}
bind = CONTROL, ${key}, movecurrentworkspacetomonitor, ${direction}
'')
cfg.desktop.hyprland.windowManagerBinds
)
}
# Move active window to a workspace with [1-9]
${
lib.strings.concatMapStringsSep "\n"
(x: "bind = , ${toString x}, movetoworkspace, ${toString x}")
[1 2 3 4 5 6 7 8 9]
}
# hyprnome
${lib.strings.concatLines moveMonitorBinds}
${lib.strings.concatLines moveWindowBinds}
${lib.strings.concatLines moveWorkspaceBinds}
bind=,comma,exec,${lib.getExe pkgs.hyprnome} --previous --move
bind=,period,exec,${lib.getExe pkgs.hyprnome} --move
bind=,escape,submap,reset