feat(hyprland): add remaining window actions #153
@@ -8,6 +8,85 @@
|
|||||||
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 {
|
||||||
|
|
||||||
|
# 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; }
|
||||||
|
})";
|
||||||
|
"move-window" = "hl.dsp.window.move(${
|
||||||
|
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
||||||
|
})";
|
||||||
|
"resize-window" = "hl.dsp.window.resize(${
|
||||||
|
lib.generators.toLua { } (
|
||||||
|
{
|
||||||
|
down = {
|
||||||
|
x = 0;
|
||||||
|
y = 10;
|
||||||
|
relative = true;
|
||||||
|
};
|
||||||
|
left = {
|
||||||
|
x = -10;
|
||||||
|
y = 0;
|
||||||
|
relative = true;
|
||||||
|
};
|
||||||
|
right = {
|
||||||
|
x = 10;
|
||||||
|
y = 0;
|
||||||
|
relative = true;
|
||||||
|
};
|
||||||
|
up = {
|
||||||
|
x = 0;
|
||||||
|
y = -10;
|
||||||
|
relative = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
.${keybind.action.direction}
|
||||||
|
)
|
||||||
|
})";
|
||||||
|
"toggle-floating" = ''hl.dsp.window.float({ action = "toggle" })'';
|
||||||
|
"toggle-fullscreen" = "hl.dsp.window.fullscreen()";
|
||||||
|
"close-window" = "hl.dsp.window.close()";
|
||||||
|
}
|
||||||
|
.${keybind.action.kind}
|
||||||
|
))
|
||||||
|
]
|
||||||
|
++ lib.optional keybind.repeating {
|
||||||
|
repeating = true;
|
||||||
|
};
|
||||||
|
}) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind);
|
||||||
|
};
|
||||||
|
};
|
||||||
registry.keybind.${config.networking.hostName} = lib.mkMerge [
|
registry.keybind.${config.networking.hostName} = lib.mkMerge [
|
||||||
# Generate numeric workspace keybinds.
|
# Generate numeric workspace keybinds.
|
||||||
(lib.listToAttrs (
|
(lib.listToAttrs (
|
||||||
@@ -93,82 +172,22 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
|
{
|
||||||
|
hyprland-toggle-floating = {
|
||||||
|
keys = "SUPER + Space";
|
||||||
|
action.kind = "toggle-floating";
|
||||||
|
};
|
||||||
|
|
||||||
|
hyprland-toggle-fullscreen = {
|
||||||
|
keys = "SUPER + F";
|
||||||
|
action.kind = "toggle-fullscreen";
|
||||||
|
};
|
||||||
|
|
||||||
|
hyprland-close-window = {
|
||||||
|
keys = "SUPER + SHIFT + Q";
|
||||||
|
action.kind = "close-window";
|
||||||
|
};
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
# 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; }
|
|
||||||
})";
|
|
||||||
"move-window" = "hl.dsp.window.move(${
|
|
||||||
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
|
||||||
})";
|
|
||||||
"resize-window" = "hl.dsp.window.resize(${
|
|
||||||
lib.generators.toLua { } (
|
|
||||||
{
|
|
||||||
down = {
|
|
||||||
x = 0;
|
|
||||||
y = 10;
|
|
||||||
relative = true;
|
|
||||||
};
|
|
||||||
left = {
|
|
||||||
x = -10;
|
|
||||||
y = 0;
|
|
||||||
relative = true;
|
|
||||||
};
|
|
||||||
right = {
|
|
||||||
x = 10;
|
|
||||||
y = 0;
|
|
||||||
relative = true;
|
|
||||||
};
|
|
||||||
up = {
|
|
||||||
x = 0;
|
|
||||||
y = -10;
|
|
||||||
relative = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
.${keybind.action.direction}
|
|
||||||
)
|
|
||||||
})";
|
|
||||||
}
|
|
||||||
.${keybind.action.kind}
|
|
||||||
))
|
|
||||||
]
|
|
||||||
++ lib.optional keybind.repeating {
|
|
||||||
repeating = true;
|
|
||||||
};
|
|
||||||
}) (lib.attrByPath [ config.networking.hostName ] { } config.registry.keybind);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,16 @@
|
|||||||
&& entry.value.action.direction != null
|
&& entry.value.action.direction != null
|
||||||
&& entry.value.action.workspace == null
|
&& entry.value.action.workspace == null
|
||||||
)
|
)
|
||||||
|
|| (
|
||||||
|
builtins.elem entry.value.action.kind [
|
||||||
|
"toggle-floating"
|
||||||
|
"toggle-fullscreen"
|
||||||
|
"close-window"
|
||||||
|
]
|
||||||
|
&& entry.value.action.command == null
|
||||||
|
&& entry.value.action.direction == null
|
||||||
|
&& entry.value.action.workspace == null
|
||||||
|
)
|
||||||
) entries;
|
) entries;
|
||||||
message = "Desktop keybind actions must set the fields their kind requires.";
|
message = "Desktop keybind actions must set the fields their kind requires.";
|
||||||
}
|
}
|
||||||
@@ -54,6 +64,9 @@
|
|||||||
"focus"
|
"focus"
|
||||||
"move-window"
|
"move-window"
|
||||||
"resize-window"
|
"resize-window"
|
||||||
|
"toggle-floating"
|
||||||
|
"toggle-fullscreen"
|
||||||
|
"close-window"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user