feat(hyprland): add directional focus binds
This commit was merged in pull request #150.
This commit is contained in:
@@ -8,18 +8,56 @@
|
||||
options.modules.desktop.session.hyprland.enable = lib.mkEnableOption "the Hyprland compositor";
|
||||
|
||||
config = lib.mkIf config.modules.desktop.session.hyprland.enable {
|
||||
registry.keybind.${config.networking.hostName} = lib.listToAttrs (
|
||||
map (workspace: {
|
||||
name = "hyprland-workspace-${toString workspace}";
|
||||
value = {
|
||||
keys = "SUPER + ${toString workspace}";
|
||||
action = {
|
||||
kind = "focus-workspace";
|
||||
inherit workspace;
|
||||
registry.keybind.${config.networking.hostName} = lib.mkMerge [
|
||||
# Generate numeric workspace keybinds.
|
||||
(lib.listToAttrs (
|
||||
map (workspace: {
|
||||
name = "hyprland-workspace-${toString workspace}";
|
||||
value = {
|
||||
keys = "SUPER + ${toString workspace}";
|
||||
action = {
|
||||
kind = "focus";
|
||||
inherit workspace;
|
||||
};
|
||||
};
|
||||
};
|
||||
}) (lib.range 1 9)
|
||||
);
|
||||
}) (lib.range 1 9)
|
||||
))
|
||||
# Generate directional keybinds.
|
||||
(lib.listToAttrs (
|
||||
map
|
||||
(
|
||||
{ direction, key }:
|
||||
{
|
||||
name = "hyprland-focus-${direction}";
|
||||
value = {
|
||||
keys = "SUPER + ${key}";
|
||||
action = {
|
||||
kind = "focus";
|
||||
inherit direction;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
[
|
||||
{
|
||||
key = "H";
|
||||
direction = "left";
|
||||
}
|
||||
{
|
||||
key = "J";
|
||||
direction = "down";
|
||||
}
|
||||
{
|
||||
key = "K";
|
||||
direction = "up";
|
||||
}
|
||||
{
|
||||
key = "L";
|
||||
direction = "right";
|
||||
}
|
||||
]
|
||||
))
|
||||
];
|
||||
|
||||
# This program integration owns the session, portals, and polkit, launched
|
||||
# through the universal Wayland session manager.
|
||||
@@ -53,8 +91,8 @@
|
||||
(lib.generators.mkLuaInline (
|
||||
{
|
||||
exec = "hl.dsp.exec_cmd(${lib.generators.toLua { } keybind.action.command})";
|
||||
"focus-workspace" = "hl.dsp.focus(${
|
||||
lib.generators.toLua { } { inherit (keybind.action) workspace; }
|
||||
focus = "hl.dsp.focus(${
|
||||
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
||||
})";
|
||||
}
|
||||
.${keybind.action.kind}
|
||||
|
||||
Reference in New Issue
Block a user