refactor(hyprland): narrow keybind merge
This commit is contained in:
@@ -7,101 +7,96 @@
|
|||||||
{
|
{
|
||||||
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
||||||
|
|
||||||
config = lib.mkIf config.modules.desktop.session.hyprland.enable (
|
config = lib.mkIf config.modules.desktop.session.hyprland.enable {
|
||||||
lib.mkMerge [
|
registry.keybind.${config.networking.hostName} = lib.mkMerge [
|
||||||
{
|
{
|
||||||
registry.keybind.${config.networking.hostName} = {
|
hyprland-focus-left = {
|
||||||
hyprland-focus-left = {
|
keys = "SUPER + H";
|
||||||
keys = "SUPER + H";
|
action = {
|
||||||
action = {
|
kind = "focus";
|
||||||
kind = "focus";
|
direction = "left";
|
||||||
direction = "left";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
hyprland-focus-down = {
|
hyprland-focus-down = {
|
||||||
keys = "SUPER + J";
|
keys = "SUPER + J";
|
||||||
action = {
|
action = {
|
||||||
kind = "focus";
|
kind = "focus";
|
||||||
direction = "down";
|
direction = "down";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
hyprland-focus-up = {
|
hyprland-focus-up = {
|
||||||
keys = "SUPER + K";
|
keys = "SUPER + K";
|
||||||
action = {
|
action = {
|
||||||
kind = "focus";
|
kind = "focus";
|
||||||
direction = "up";
|
direction = "up";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
hyprland-focus-right = {
|
hyprland-focus-right = {
|
||||||
keys = "SUPER + L";
|
keys = "SUPER + L";
|
||||||
action = {
|
action = {
|
||||||
kind = "focus";
|
kind = "focus";
|
||||||
direction = "right";
|
direction = "right";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
(lib.listToAttrs (
|
||||||
registry.keybind.${config.networking.hostName} = lib.listToAttrs (
|
map (workspace: {
|
||||||
map (workspace: {
|
name = "hyprland-workspace-${toString workspace}";
|
||||||
name = "hyprland-workspace-${toString workspace}";
|
value = {
|
||||||
value = {
|
keys = "SUPER + ${toString workspace}";
|
||||||
keys = "SUPER + ${toString workspace}";
|
action = {
|
||||||
action = {
|
kind = "focus";
|
||||||
kind = "focus";
|
inherit workspace;
|
||||||
inherit workspace;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}) (lib.range 1 9)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# This program integration owns the session, portals, and polkit, launched
|
|
||||||
# through the universal Wayland session manager.
|
|
||||||
programs.hyprland = {
|
|
||||||
enable = true;
|
|
||||||
withUWSM = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users.${config.user.name}.wayland.windowManager.hyprland = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
# One package drives the whole session, so there is never a version split.
|
|
||||||
# The program integration above installs it and the portal, leaving home-
|
|
||||||
# manager to write only the config.
|
|
||||||
package = null;
|
|
||||||
portalPackage = null;
|
|
||||||
|
|
||||||
# uwsm owns the systemd graphical-session targets.
|
|
||||||
systemd.enable = false;
|
|
||||||
|
|
||||||
# Write the native Lua Hyprland config. Home Manager renders the Nix
|
|
||||||
# settings below as hl.* calls.
|
|
||||||
configType = "lua";
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
config.general.layout = "dwindle";
|
|
||||||
|
|
||||||
bind = lib.mapAttrsToList (_name: keybind: {
|
|
||||||
_args = [
|
|
||||||
keybind.keys
|
|
||||||
(lib.generators.mkLuaInline (
|
|
||||||
{
|
|
||||||
exec = "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})";
|
|
||||||
focus = "hl.dsp.focus(${
|
|
||||||
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
|
||||||
})";
|
|
||||||
}
|
|
||||||
.${keybind.action.kind}
|
|
||||||
))
|
|
||||||
];
|
|
||||||
}) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind);
|
|
||||||
};
|
};
|
||||||
};
|
}) (lib.range 1 9)
|
||||||
}
|
))
|
||||||
]
|
];
|
||||||
);
|
|
||||||
|
# This program integration owns the session, portals, and polkit, launched
|
||||||
|
# through the universal Wayland session manager.
|
||||||
|
programs.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
withUWSM = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.${config.user.name}.wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# One package drives the whole session, so there is never a version split.
|
||||||
|
# The program integration above installs it and the portal, leaving home-
|
||||||
|
# manager to write only the config.
|
||||||
|
package = null;
|
||||||
|
portalPackage = null;
|
||||||
|
|
||||||
|
# uwsm owns the systemd graphical-session targets.
|
||||||
|
systemd.enable = false;
|
||||||
|
|
||||||
|
# Write the native Lua Hyprland config. Home Manager renders the Nix
|
||||||
|
# settings below as hl.* calls.
|
||||||
|
configType = "lua";
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
config.general.layout = "dwindle";
|
||||||
|
|
||||||
|
bind = lib.mapAttrsToList (_name: keybind: {
|
||||||
|
_args = [
|
||||||
|
keybind.keys
|
||||||
|
(lib.generators.mkLuaInline (
|
||||||
|
{
|
||||||
|
exec = "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})";
|
||||||
|
focus = "hl.dsp.focus(${
|
||||||
|
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
||||||
|
})";
|
||||||
|
}
|
||||||
|
.${keybind.action.kind}
|
||||||
|
))
|
||||||
|
];
|
||||||
|
}) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user