292 lines
10 KiB
Nix
292 lines
10 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.wayland.windowManager.hyprland;
|
|
in
|
|
{
|
|
config = lib.mkIf cfg.enable {
|
|
wayland.windowManager.hyprland.settings =
|
|
let
|
|
exe = lib.getExe;
|
|
terminalCommand = "alacritty";
|
|
resizeAmount = toString 10;
|
|
in
|
|
{
|
|
mod._var = "SUPER";
|
|
|
|
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
|
|
bind =
|
|
let
|
|
lua = lib.generators.mkLuaInline;
|
|
mod = key: args: {
|
|
_args = [
|
|
(lua "mod .. \" + ${key}\"")
|
|
]
|
|
++ args;
|
|
};
|
|
in
|
|
[
|
|
# Layout actions
|
|
|
|
(mod "U" [
|
|
(lua "hl.dsp.layout(\"togglesplit\")")
|
|
])
|
|
|
|
(mod "Y" [
|
|
(lua "hl.dsp.window.float({ action = \"toggle\" })")
|
|
])
|
|
|
|
(mod "T" [
|
|
(lua "hl.dsp.window.fullscreen({ action = \"toggle\", mode = \"maximized\" })")
|
|
])
|
|
|
|
(mod "C" [
|
|
(lua "hl.dsp.exec_cmd(\"hyprctl reload\")")
|
|
])
|
|
|
|
# Left click drag
|
|
(mod "mouse:272" [
|
|
(lua "hl.dsp.window.drag()")
|
|
(lua "{ mouse = true }")
|
|
])
|
|
|
|
# Right click drag
|
|
(mod "mouse:273" [
|
|
(lua "hl.dsp.window.resize()")
|
|
(lua "{ mouse = true }")
|
|
])
|
|
|
|
# Scroll through workspaces on this monitor
|
|
(mod "mouse_up" [
|
|
(lua "hl.dsp.focus({ workspace = \"r+1\" })")
|
|
])
|
|
(mod "mouse_down" [
|
|
(lua "hl.dsp.focus({ workspace = \"r-1\" })")
|
|
])
|
|
|
|
# Window actions
|
|
(mod "W" [
|
|
(lua "hl.dsp.window.close()")
|
|
])
|
|
|
|
(mod "SHIFT + W" [
|
|
(lua "hl.dsp.window.kill()")
|
|
])
|
|
|
|
# Application launches
|
|
(mod "RETURN" [
|
|
(lua "hl.dsp.exec_cmd(\"${terminalCommand}\")")
|
|
])
|
|
|
|
(mod "SPACE" [
|
|
(lua "hl.dsp.exec_cmd(\"rofi -show drun\")")
|
|
])
|
|
|
|
(mod "A" [
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.pavucontrol}\")")
|
|
])
|
|
|
|
(mod "B" [
|
|
(lua "hl.dsp.exec_cmd(\"rofi-rbw\")")
|
|
])
|
|
|
|
(mod "N" [
|
|
(lua "hl.dsp.exec_cmd(\"swaync-client -t -sw\")")
|
|
])
|
|
|
|
(mod "P" [
|
|
(lua "hl.dsp.exec_cmd(\"${terminalCommand} -e python3\")")
|
|
])
|
|
|
|
(mod "V" [
|
|
(lua "hl.dsp.exec_cmd(\"rofi -modi clipboard:${pkgs.cliphist}/bin/cliphist-rofi-img -show clipboard\")")
|
|
])
|
|
|
|
# Focus workspace
|
|
(mod "1" [ (lua "hl.dsp.focus({ workspace = 1 })") ])
|
|
(mod "2" [ (lua "hl.dsp.focus({ workspace = 2 })") ])
|
|
(mod "3" [ (lua "hl.dsp.focus({ workspace = 3 })") ])
|
|
(mod "4" [ (lua "hl.dsp.focus({ workspace = 4 })") ])
|
|
(mod "5" [ (lua "hl.dsp.focus({ workspace = 5 })") ])
|
|
(mod "6" [ (lua "hl.dsp.focus({ workspace = 6 })") ])
|
|
(mod "7" [ (lua "hl.dsp.focus({ workspace = 7 })") ])
|
|
(mod "8" [ (lua "hl.dsp.focus({ workspace = 8 })") ])
|
|
(mod "9" [ (lua "hl.dsp.focus({ workspace = 9 })") ])
|
|
|
|
# Move window to workspace
|
|
(mod "SHIFT + 1" [ (lua "hl.dsp.window.move({ workspace = 1 })") ])
|
|
(mod "SHIFT + 2" [ (lua "hl.dsp.window.move({ workspace = 2 })") ])
|
|
(mod "SHIFT + 3" [ (lua "hl.dsp.window.move({ workspace = 3 })") ])
|
|
(mod "SHIFT + 4" [ (lua "hl.dsp.window.move({ workspace = 4 })") ])
|
|
(mod "SHIFT + 5" [ (lua "hl.dsp.window.move({ workspace = 5 })") ])
|
|
(mod "SHIFT + 6" [ (lua "hl.dsp.window.move({ workspace = 6 })") ])
|
|
(mod "SHIFT + 7" [ (lua "hl.dsp.window.move({ workspace = 7 })") ])
|
|
(mod "SHIFT + 8" [ (lua "hl.dsp.window.move({ workspace = 8 })") ])
|
|
(mod "SHIFT + 9" [ (lua "hl.dsp.window.move({ workspace = 9 })") ])
|
|
|
|
# Focus window
|
|
(mod "LEFT" [ (lua "hl.dsp.focus({ direction=\"left\" })") ])
|
|
(mod "RIGHT" [ (lua "hl.dsp.focus({ direction=\"right\" })") ])
|
|
(mod "UP" [ (lua "hl.dsp.focus({ direction=\"up\" })") ])
|
|
(mod "DOWN" [ (lua "hl.dsp.focus({ direction=\"down\" })") ])
|
|
(mod "H" [ (lua "hl.dsp.focus({ direction=\"left\" })") ])
|
|
(mod "L" [ (lua "hl.dsp.focus({ direction=\"right\" })") ])
|
|
(mod "K" [ (lua "hl.dsp.focus({ direction=\"up\" })") ])
|
|
(mod "J" [ (lua "hl.dsp.focus({ direction=\"down\" })") ])
|
|
|
|
# Move window
|
|
(mod "SHIFT + LEFT" [ (lua "hl.dsp.window.move({ direction=\"left\" })") ])
|
|
(mod "SHIFT + RIGHT" [ (lua "hl.dsp.window.move({ direction=\"right\" })") ])
|
|
(mod "SHIFT + UP" [ (lua "hl.dsp.window.move({ direction=\"up\" })") ])
|
|
(mod "SHIFT + DOWN" [ (lua "hl.dsp.window.move({ direction=\"down\" })") ])
|
|
(mod "SHIFT + H" [ (lua "hl.dsp.window.move({ direction=\"left\" })") ])
|
|
(mod "SHIFT + L" [ (lua "hl.dsp.window.move({ direction=\"right\" })") ])
|
|
(mod "SHIFT + K" [ (lua "hl.dsp.window.move({ direction=\"up\" })") ])
|
|
(mod "SHIFT + J" [ (lua "hl.dsp.window.move({ direction=\"down\" })") ])
|
|
|
|
# Resize window
|
|
(mod "CONTROL + LEFT" [
|
|
(lua "hl.dsp.window.resize({ x = -${resizeAmount}, y = 0, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + RIGHT" [
|
|
(lua "hl.dsp.window.resize({ x = ${resizeAmount}, y = 0, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + UP" [
|
|
(lua "hl.dsp.window.resize({ x = 0, y = -${resizeAmount}, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + DOWN" [
|
|
(lua "hl.dsp.window.resize({ x = 0, y = ${resizeAmount}, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + H" [
|
|
(lua "hl.dsp.window.resize({ x = -${resizeAmount}, y = 0, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + L" [
|
|
(lua "hl.dsp.window.resize({ x = ${resizeAmount}, y = 0, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + K" [
|
|
(lua "hl.dsp.window.resize({ x = 0, y = -${resizeAmount}, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
(mod "CONTROL + J" [
|
|
(lua "hl.dsp.window.resize({ x = 0, y = ${resizeAmount}, relative = true })")
|
|
(lua "{ repeating = true }")
|
|
])
|
|
|
|
# TODO - replace with hyprlock?
|
|
(mod "F1" [ (lua "hl.dsp.exec_cmd(\"${pkgs.systemd}/bin/loginctl lock-session\")") ])
|
|
|
|
# Screenshots
|
|
{
|
|
_args = [
|
|
(lua "\"PRINT\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.hyprshot} -m output --clipboard-only\")")
|
|
];
|
|
}
|
|
{
|
|
_args = [
|
|
(lua "\"CTRL + PRINT\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.hyprshot} -m region --clipboard-only\")")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"CTRL + SHIFT + PRINT\"")
|
|
(lua "hl.dsp.exec_cmd(\"HYPRSHOT_DIR=/home/felixalb/images/screenshots ${exe pkgs.hyprshot} -m region \")")
|
|
];
|
|
}
|
|
|
|
# Media controls
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioPlay\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} play-pause\")")
|
|
(lua "{ locked = true }")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioPause\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} play-pause\")")
|
|
(lua "{ locked = true }")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioPrev\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} previous\")")
|
|
(lua "{ locked = true }")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioNext\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.playerctl} next\")")
|
|
(lua "{ locked = true }")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioMute\"")
|
|
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle\")")
|
|
(lua "{ locked = true, repeating = true }")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioMicMute\"")
|
|
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle\")")
|
|
(lua "{ locked = true, repeating = true }")
|
|
];
|
|
}
|
|
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioLowerVolume\"")
|
|
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-\")")
|
|
(lua "{ locked = true, repeating = true }")
|
|
];
|
|
}
|
|
{
|
|
_args = [
|
|
(lua "\"XF86AudioRaiseVolume\"")
|
|
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+\")")
|
|
(lua "{ locked = true, repeating = true }")
|
|
];
|
|
}
|
|
|
|
# Laptop controls
|
|
{
|
|
_args = [
|
|
(lua "\"XF86MonBrightnessUp\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 10%+\")")
|
|
(lua "{ locked = true, repeating = true }")
|
|
];
|
|
}
|
|
{
|
|
_args = [
|
|
(lua "\"XF86MonBrightnessDown\"")
|
|
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 10%-\")")
|
|
(lua "{ locked = true, repeating = true }")
|
|
];
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|