feat(hyprland): add window movement binds #151
@@ -11,32 +11,57 @@
|
|||||||
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 (
|
||||||
map (workspace: {
|
lib.concatMap (workspace: [
|
||||||
name = "hyprland-workspace-${toString workspace}";
|
{
|
||||||
value = {
|
name = "hyprland-workspace-${toString workspace}";
|
||||||
keys = "SUPER + ${toString workspace}";
|
value = {
|
||||||
action = {
|
keys = "SUPER + ${toString workspace}";
|
||||||
kind = "focus";
|
action = {
|
||||||
inherit workspace;
|
kind = "focus";
|
||||||
|
inherit workspace;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}) (lib.range 1 9)
|
{
|
||||||
|
name = "hyprland-move-to-workspace-${toString workspace}";
|
||||||
|
value = {
|
||||||
|
keys = "SUPER + SHIFT + ${toString workspace}";
|
||||||
|
action = {
|
||||||
|
kind = "move-window";
|
||||||
|
inherit workspace;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]) (lib.range 1 9)
|
||||||
))
|
))
|
||||||
|
|
||||||
# Generate directional keybinds.
|
# Generate directional keybinds.
|
||||||
(lib.listToAttrs (
|
(lib.listToAttrs (
|
||||||
map
|
lib.concatMap
|
||||||
(
|
(
|
||||||
{ direction, key }:
|
{ direction, key }:
|
||||||
{
|
[
|
||||||
name = "hyprland-focus-${direction}";
|
{
|
||||||
value = {
|
name = "hyprland-focus-${direction}";
|
||||||
keys = "SUPER + ${key}";
|
value = {
|
||||||
action = {
|
keys = "SUPER + ${key}";
|
||||||
kind = "focus";
|
action = {
|
||||||
inherit direction;
|
kind = "focus";
|
||||||
|
inherit direction;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
{
|
||||||
|
name = "hyprland-move-${direction}";
|
||||||
|
value = {
|
||||||
|
keys = "SUPER + SHIFT + ${key}";
|
||||||
|
action = {
|
||||||
|
kind = "move-window";
|
||||||
|
inherit direction;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
]
|
||||||
)
|
)
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -94,6 +119,9 @@
|
|||||||
focus = "hl.dsp.focus(${
|
focus = "hl.dsp.focus(${
|
||||||
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
||||||
})";
|
})";
|
||||||
|
"move-window" = "hl.dsp.window.move(${
|
||||||
|
lib.generators.toLua { } { inherit (keybind.action) direction workspace; }
|
||||||
|
})";
|
||||||
}
|
}
|
||||||
.${keybind.action.kind}
|
.${keybind.action.kind}
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -12,7 +12,10 @@
|
|||||||
entry:
|
entry:
|
||||||
(entry.value.action.kind == "exec" && entry.value.action.command != null)
|
(entry.value.action.kind == "exec" && entry.value.action.command != null)
|
||||||
|| (
|
|| (
|
||||||
entry.value.action.kind == "focus"
|
builtins.elem entry.value.action.kind [
|
||||||
|
"focus"
|
||||||
|
"move-window"
|
||||||
|
]
|
||||||
&& lib.xor (entry.value.action.direction != null) (entry.value.action.workspace != null)
|
&& lib.xor (entry.value.action.direction != null) (entry.value.action.workspace != null)
|
||||||
)
|
)
|
||||||
) entries;
|
) entries;
|
||||||
@@ -37,6 +40,7 @@
|
|||||||
type = lib.types.enum [
|
type = lib.types.enum [
|
||||||
"exec"
|
"exec"
|
||||||
"focus"
|
"focus"
|
||||||
|
"move-window"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,7 +52,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
direction = lib.mkOption {
|
direction = lib.mkOption {
|
||||||
description = "Direction focused by a focus keybind.";
|
description = "Direction targeted by a keybind action.";
|
||||||
type = lib.types.nullOr (
|
type = lib.types.nullOr (
|
||||||
lib.types.enum [
|
lib.types.enum [
|
||||||
"down"
|
"down"
|
||||||
@@ -62,7 +66,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
workspace = lib.mkOption {
|
workspace = lib.mkOption {
|
||||||
description = "Workspace focused by a focus keybind.";
|
description = "Workspace targeted by a keybind action.";
|
||||||
type = lib.types.nullOr lib.types.int;
|
type = lib.types.nullOr lib.types.int;
|
||||||
default = null;
|
default = null;
|
||||||
example = 1;
|
example = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user