home/hyprland: migrate config to lua
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
wayland.windowManager.hyprland = {
|
||||
systemd.enable = false;
|
||||
@@ -5,85 +6,128 @@
|
||||
configType = "lua";
|
||||
|
||||
settings = {
|
||||
exec-once = [
|
||||
"uwsm finalize"
|
||||
on._args = [
|
||||
"hyprland.start"
|
||||
(lib.generators.mkLuaInline ''
|
||||
function()
|
||||
hl.exec_cmd("uwsm finalize")
|
||||
end
|
||||
'')
|
||||
];
|
||||
|
||||
monitor = [
|
||||
# TODO: host specific
|
||||
"eDP-1, 3840x2400@90.00Hz, 0x0, 2"
|
||||
{
|
||||
output = "eDP-1";
|
||||
mode = "3840x2400@90.00Hz";
|
||||
position = "0x0";
|
||||
scale = "2";
|
||||
}
|
||||
|
||||
# PVV Demiurgen
|
||||
"desc:Hewlett Packard HP ZR24w CNT01711G6, 1920x1200, 0x-1200, 1"
|
||||
"desc:Hewlett Packard HP ZR24w CNT018103H, 1920x1200, 1920x-1200, 1"
|
||||
{
|
||||
output = "desc:Hewlett Packard HP ZR24w CNT01711G6";
|
||||
mode = "1920x1200";
|
||||
position = "1920x-1200";
|
||||
scale = "1";
|
||||
}
|
||||
{
|
||||
output = "desc:Hewlett Packard HP ZR24w CNT018103H";
|
||||
mode = "1920x1200";
|
||||
position = "0x-1200";
|
||||
scale = "1";
|
||||
}
|
||||
|
||||
# PVV Eirin
|
||||
"desc:Hewlett Packard HP ZR24w CNT01710L4, 1920x1200, 0x-1200, 1"
|
||||
"desc:Hewlett Packard HP ZR24w CNT0181039, 1920x1200, 1920x-1200, 1"
|
||||
{
|
||||
output = "desc:Hewlett Packard HP ZR24w CNT01710L4";
|
||||
mode = "1920x1200";
|
||||
position = "1920x-1200";
|
||||
scale = "1";
|
||||
}
|
||||
{
|
||||
output = "desc:Hewlett Packard HP ZR24w CNT0181039";
|
||||
mode = "1920x1200";
|
||||
position = "0x-1200";
|
||||
scale = "1";
|
||||
}
|
||||
|
||||
",preferred,auto,1"
|
||||
{
|
||||
output = "";
|
||||
mode = "preferred";
|
||||
position = "auto";
|
||||
scale = "auto";
|
||||
}
|
||||
];
|
||||
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 15;
|
||||
config = {
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 15;
|
||||
|
||||
border_size = 2;
|
||||
border_size = 2;
|
||||
|
||||
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
||||
"col.inactive_border" = "rgba(595959aa)";
|
||||
"col.active_border" = {
|
||||
colors = [
|
||||
"rgba(33ccffee)"
|
||||
"rgba(00ff99ee)"
|
||||
];
|
||||
angle = 45;
|
||||
};
|
||||
"col.inactive_border" = "rgba(595959aa)";
|
||||
|
||||
resize_on_border = false;
|
||||
allow_tearing = false;
|
||||
layout = "master";
|
||||
};
|
||||
|
||||
decoration = {
|
||||
rounding = 10;
|
||||
|
||||
# Change transparency of focused and unfocused windows
|
||||
active_opacity = 1.0;
|
||||
inactive_opacity = 1.0;
|
||||
|
||||
# drop_shadow = true;
|
||||
# shadow_range = 4;
|
||||
# shadow_render_power = 3;
|
||||
# "col.shadow" = "rgba(1a1a1aee)";
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#blur
|
||||
blur = {
|
||||
enabled = true;
|
||||
size = 3;
|
||||
passes = 1;
|
||||
|
||||
vibrancy = 0.1696;
|
||||
resize_on_border = false;
|
||||
allow_tearing = false;
|
||||
layout = "master";
|
||||
};
|
||||
};
|
||||
|
||||
animations.enabled = false;
|
||||
decoration = {
|
||||
rounding = 10;
|
||||
|
||||
master = {
|
||||
new_status = "slave";
|
||||
};
|
||||
# Change transparency of focused and unfocused windows
|
||||
active_opacity = 1.0;
|
||||
inactive_opacity = 1.0;
|
||||
|
||||
misc = {
|
||||
force_default_wallpaper = 0; # Set to 0 or 1 to disable the anime mascot wallpapers
|
||||
disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
|
||||
};
|
||||
# drop_shadow = true;
|
||||
# shadow_range = 4;
|
||||
# shadow_render_power = 3;
|
||||
# "col.shadow" = "rgba(1a1a1aee)";
|
||||
|
||||
input ={
|
||||
kb_layout = "us";
|
||||
kb_variant = "";
|
||||
kb_model = "";
|
||||
kb_options = "caps:escape";
|
||||
kb_rules = "";
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#blur
|
||||
blur = {
|
||||
enabled = true;
|
||||
size = 3;
|
||||
passes = 1;
|
||||
|
||||
follow_mouse = 1;
|
||||
vibrancy = 0.1696;
|
||||
};
|
||||
};
|
||||
|
||||
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
|
||||
animations.enabled = false;
|
||||
|
||||
touchpad = {
|
||||
natural_scroll = false;
|
||||
master = {
|
||||
new_status = "slave";
|
||||
};
|
||||
|
||||
misc = {
|
||||
force_default_wallpaper = 0; # Set to 0 or 1 to disable the anime mascot wallpapers
|
||||
disable_hyprland_logo = false; # If true disables the random hyprland logo / anime girl background. :(
|
||||
};
|
||||
|
||||
input ={
|
||||
kb_layout = "us";
|
||||
kb_variant = "";
|
||||
kb_model = "";
|
||||
kb_options = "caps:escape";
|
||||
kb_rules = "";
|
||||
|
||||
follow_mouse = 1;
|
||||
|
||||
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
|
||||
|
||||
touchpad = {
|
||||
natural_scroll = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,87 +7,189 @@ in
|
||||
wayland.windowManager.hyprland.settings = let
|
||||
exe = lib.getExe;
|
||||
in {
|
||||
"$mod" = "SUPER";
|
||||
mod._var = "SUPER";
|
||||
|
||||
# https://github.com/xkbcommon/libxkbcommon/blob/master/include/xkbcommon/xkbcommon-keysyms.h
|
||||
bind = [
|
||||
"$mod SHIFT, Q, exec, uwsm stop"
|
||||
"$mod ALT SHIFT, Q, exec, ${pkgs.systemd}/bin/loginctl terminate-user \"${config.home.username}\""
|
||||
"$mod, R, exec, uwsm app -- ${exe config.programs.anyrun.package}"
|
||||
"$mod, T, togglefloating"
|
||||
bind = let
|
||||
lua = lib.generators.mkLuaInline;
|
||||
mod = key: args: {
|
||||
_args = [
|
||||
(lua "mod .. \" + ${key}\"")
|
||||
] ++ args;
|
||||
};
|
||||
in [
|
||||
(mod "SHIFT + Q" [
|
||||
(lua "hl.dsp.exec_cmd(\"uwsm stop\")")
|
||||
])
|
||||
(mod "ALT + SHIFT + Q" [
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.systemd}/bin/loginctl terminate-user '${config.home.username}'\")")
|
||||
])
|
||||
(mod "R" [
|
||||
(lua "hl.dsp.exec_cmd(\"uwsm app -- ${exe config.programs.anyrun.package}\")")
|
||||
])
|
||||
(mod "T" [
|
||||
(lua "hl.dsp.window.float({ action = \"toggle\" })")
|
||||
])
|
||||
|
||||
"$mod, F, fullscreenstate, 1"
|
||||
"$mod SHIFT, F, fullscreenstate, 3"
|
||||
"$mod, C, exec, ${cfg.finalPackage}/bin/hyprctl reload"
|
||||
(mod "F" [
|
||||
(lua "hl.dsp.window.fullscreen({ action = \"toggle\", mode = \"maximized\" })")
|
||||
])
|
||||
(mod "SHIFT + F" [
|
||||
(lua "hl.dsp.window.fullscreen({ action = \"toggle\", mode = \"fullscreen\" })")
|
||||
])
|
||||
|
||||
"$mod, BACKSPACE, killactive"
|
||||
(mod "C" [
|
||||
(lua "hl.dsp.exec_cmd(\"${cfg.finalPackage}/bin/hyprctl reload\")")
|
||||
])
|
||||
|
||||
"$mod SHIFT, RETURN, exec, ${exe pkgs.app2unit} -t service -C -s app-graphical.slice -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term"
|
||||
"$mod SHIFT, SPACE, exec, ${exe pkgs.app2unit} -t service -C -s app-graphical.slice -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term"
|
||||
(mod "BACKSPACE" [
|
||||
(lua "hl.dsp.window.close()")
|
||||
])
|
||||
|
||||
"$mod, j, layoutmsg,cyclenext"
|
||||
"$mod, k, layoutmsg,cycleprev"
|
||||
"$mod SHIFT, j, layoutmsg, swapnext"
|
||||
"$mod SHIFT, k, layoutmsg, swapprev"
|
||||
(mod "SHIFT + BACKSPACE" [
|
||||
(lua "hl.dsp.window.kill()")
|
||||
])
|
||||
|
||||
"$mod, 1, focusworkspaceoncurrentmonitor, 1"
|
||||
"$mod, 2, focusworkspaceoncurrentmonitor, 2"
|
||||
"$mod, 3, focusworkspaceoncurrentmonitor, 3"
|
||||
"$mod, 4, focusworkspaceoncurrentmonitor, 4"
|
||||
"$mod, 5, focusworkspaceoncurrentmonitor, 5"
|
||||
"$mod, 6, focusworkspaceoncurrentmonitor, 6"
|
||||
"$mod, 7, focusworkspaceoncurrentmonitor, 7"
|
||||
"$mod, 8, focusworkspaceoncurrentmonitor, 8"
|
||||
"$mod, 9, focusworkspaceoncurrentmonitor, 9"
|
||||
(mod "SHIFT + RETURN" [
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.app2unit} -t service -C -s app-graphical.slice -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term\")")
|
||||
])
|
||||
(mod "SHIFT + SPACE" [
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.app2unit} -t service -C -s app-graphical.slice -- ${exe pkgs.alacritty} --class termTerminal -e ${exe pkgs.tmux} new-session -A -s term\")")
|
||||
])
|
||||
|
||||
"$mod SHIFT, 1, movetoworkspacesilent, 1"
|
||||
"$mod SHIFT, 2, movetoworkspacesilent, 2"
|
||||
"$mod SHIFT, 3, movetoworkspacesilent, 3"
|
||||
"$mod SHIFT, 4, movetoworkspacesilent, 4"
|
||||
"$mod SHIFT, 5, movetoworkspacesilent, 5"
|
||||
"$mod SHIFT, 6, movetoworkspacesilent, 6"
|
||||
"$mod SHIFT, 7, movetoworkspacesilent, 7"
|
||||
"$mod SHIFT, 8, movetoworkspacesilent, 8"
|
||||
"$mod SHIFT, 9, movetoworkspacesilent, 9"
|
||||
(mod "j" [(lua "hl.dsp.layout(\"cyclenext\")")])
|
||||
(mod "k" [(lua "hl.dsp.layout(\"cycleprev\")")])
|
||||
(mod "SHIFT + j" [(lua "hl.dsp.layout(\"swapnext\")")])
|
||||
(mod "SHIFT + k" [(lua "hl.dsp.layout(\"swapprev\")")])
|
||||
|
||||
"$mod, b, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s mozc"
|
||||
"$mod, n, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-no"
|
||||
"$mod, m, exec, ${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-us"
|
||||
(mod "1" [(lua "hl.dsp.focus({ workspace = 1, on_current_monitor = true })")])
|
||||
(mod "2" [(lua "hl.dsp.focus({ workspace = 2, on_current_monitor = true })")])
|
||||
(mod "3" [(lua "hl.dsp.focus({ workspace = 3, on_current_monitor = true })")])
|
||||
(mod "4" [(lua "hl.dsp.focus({ workspace = 4, on_current_monitor = true })")])
|
||||
(mod "5" [(lua "hl.dsp.focus({ workspace = 5, on_current_monitor = true })")])
|
||||
(mod "6" [(lua "hl.dsp.focus({ workspace = 6, on_current_monitor = true })")])
|
||||
(mod "7" [(lua "hl.dsp.focus({ workspace = 7, on_current_monitor = true })")])
|
||||
(mod "8" [(lua "hl.dsp.focus({ workspace = 8, on_current_monitor = true })")])
|
||||
(mod "9" [(lua "hl.dsp.focus({ workspace = 9, on_current_monitor = true })")])
|
||||
|
||||
"$mod, l, exec, ${pkgs.systemd}/bin/loginctl lock-session"
|
||||
(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 })")])
|
||||
|
||||
(mod "b" [(lua "hl.dsp.exec_cmd(\"${pkgs.fcitx5}/bin/fcitx5-remote -s mozc\")")])
|
||||
(mod "n" [(lua "hl.dsp.exec_cmd(\"${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-no\")")])
|
||||
(mod "m" [(lua "hl.dsp.exec_cmd(\"${pkgs.fcitx5}/bin/fcitx5-remote -s keyboard-us\")")])
|
||||
|
||||
(mod "l" [(lua "hl.dsp.exec_cmd(\"${pkgs.systemd}/bin/loginctl lock-session\")")])
|
||||
|
||||
# TODO: fix
|
||||
# "super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter"
|
||||
|
||||
", Print, exec, ${exe pkgs.grimblast} copy area"
|
||||
{
|
||||
_args = [
|
||||
(lua "\"PRINT\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.grimblast} copy area\")")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"SHIFT + PRINT\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${lib.getExe pkgs.grimblast} save\")")
|
||||
];
|
||||
}
|
||||
|
||||
"SHIFT, Print, exec, ${lib.getExe pkgs.grimblast} save"
|
||||
# "SHIFT, Print, exec, ${lib.getExe pkgs.grimblast} save"
|
||||
# "shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png"
|
||||
|
||||
"$mod, Print, exec, ${exe pkgs.woomer}"
|
||||
];
|
||||
# "$mod, Print, exec, ${exe pkgs.woomer}"
|
||||
|
||||
bindm = [
|
||||
"$mod, mouse:272, movewindow"
|
||||
"$mod, Control_L, movewindow"
|
||||
"$mod, mouse:273, resizewindow"
|
||||
"$mod, ALT_L, resizewindow"
|
||||
];
|
||||
(mod "mouse:272" [
|
||||
(lua "hl.dsp.window.drag()")
|
||||
(lua "{ mouse = true }")
|
||||
])
|
||||
|
||||
bindl = [
|
||||
"$mod, p, exec, ${exe pkgs.mpc} toggle"
|
||||
",XF86AudioPlay, exec, ${exe pkgs.mpc} toggle"
|
||||
",XF86AudioPrev, exec, ${exe pkgs.mpc} prev"
|
||||
",XF86AudioNext, exec, ${exe pkgs.mpc} next"
|
||||
];
|
||||
(mod "Control_L" [
|
||||
(lua "hl.dsp.window.drag()")
|
||||
(lua "{ mouse = true }")
|
||||
])
|
||||
|
||||
bindle = [
|
||||
",XF86MonBrightnessUp, exec, ${exe pkgs.brightnessctl} s +5%"
|
||||
",XF86MonBrightnessDown, exec, ${exe pkgs.brightnessctl} s 5%-"
|
||||
",XF86AudioLowerVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
|
||||
",XF86AudioRaiseVolume, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
|
||||
"$mod ,F7, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"
|
||||
"$mod ,F8, exec, ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"
|
||||
(mod "mouse:273" [
|
||||
(lua "hl.dsp.window.resize()")
|
||||
(lua "{ mouse = true }")
|
||||
])
|
||||
|
||||
(mod "ALT_L" [
|
||||
(lua "hl.dsp.window.resize()")
|
||||
(lua "{ mouse = true }")
|
||||
])
|
||||
|
||||
(mod "p" [
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.mpc} toggle\")")
|
||||
(lua "{ locked = true }")
|
||||
])
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioPlay\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.mpc} toggle\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioPrev\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.mpc} prev\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioNext\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.mpc} next\")")
|
||||
(lua "{ locked = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86MonBrightnessUp\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s +5%\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86MonBrightnessDown\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${exe pkgs.brightnessctl} s 5%-\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioLowerVolume\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
{
|
||||
_args = [
|
||||
(lua "\"XF86AudioRaiseVolume\"")
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
];
|
||||
}
|
||||
(mod "F7" [
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
])
|
||||
(mod "F8" [
|
||||
(lua "hl.dsp.exec_cmd(\"${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+\")")
|
||||
(lua "{ locked = true, repeating = true }")
|
||||
])
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
{ config, pkgs, lib, ... }: let
|
||||
cfg = config.wayland.windowManager.hyprland;
|
||||
in
|
||||
{
|
||||
@@ -13,62 +12,128 @@ in
|
||||
command = "uwsm app -- ${exe pkgs.alacritty} --class ${class} -e ${exe pkgs.tmux} new-session -A -s f";
|
||||
size = { h = 90; w = 95; };
|
||||
keys = [
|
||||
"$mod, RETURN"
|
||||
"$mod, SPACE"
|
||||
(lib.generators.mkLuaInline "mod .. \" + RETURN\"")
|
||||
(lib.generators.mkLuaInline "mod .. \" + SPACE\"")
|
||||
];
|
||||
})
|
||||
(rec {
|
||||
title = "Ncmpcpp";
|
||||
class = "floatingNcmpcpp";
|
||||
command = "uwsm app -- ${exe pkgs.alacritty} --class ${class} -e ${exe pkgs.ncmpcpp}";
|
||||
size = { h = 95; w = 95; };
|
||||
keys = [ "$mod, Q" ];
|
||||
size = { h = 90; w = 95; };
|
||||
keys = [
|
||||
(lib.generators.mkLuaInline "mod .. \" + Q\"")
|
||||
];
|
||||
})
|
||||
# "$mod, W, emacs"
|
||||
# "$mod, E, filebrowser"
|
||||
# "$mod, X, taskwarriortui"
|
||||
];
|
||||
in {
|
||||
bind = lib.pipe scratchpads [
|
||||
(map ({ keys, command, class, ... }:
|
||||
(map (key: let
|
||||
# TODO: rewrite this to take arguments instead of creating n copies
|
||||
invokeIfNotRunningAndToggleWorkspace = pkgs.writeShellApplication {
|
||||
name = "hyprland-toggle-scratchpad-${class}";
|
||||
runtimeInputs = [ cfg.finalPackage pkgs.jq ];
|
||||
text = ''
|
||||
SCRATCHPAD_PROGRAM_EXISTS=$(hyprctl clients -j | jq -r '[.[].class]|any(. == "${class}")')
|
||||
CURRENT_WORKSPACE_ID=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||
scratchpads._var = scratchpads;
|
||||
|
||||
if [ "$SCRATCHPAD_PROGRAM_EXISTS" != "true" ]; then
|
||||
${command} &
|
||||
hyprctl dispatch movetoworkspacesilent "''${CURRENT_WORKSPACE_ID},class:${class}"
|
||||
hyprctl dispatch focuswindow "class:${class}"
|
||||
else
|
||||
SCRATCHPAD_PROGRAM_WORKSPACE_ID=$(hyprctl clients -j | jq '.[] | select( .class == "${class}") | .workspace.id')
|
||||
if [ "$SCRATCHPAD_PROGRAM_WORKSPACE_ID" != "$CURRENT_WORKSPACE_ID" ]; then
|
||||
hyprctl dispatch movetoworkspacesilent "''${CURRENT_WORKSPACE_ID},class:${class}"
|
||||
hyprctl dispatch focuswindow "class:${class}"
|
||||
else
|
||||
hyprctl dispatch movetoworkspacesilent "special:${class}Ws,class:${class}"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
};
|
||||
in "${key}, exec, ${lib.getExe invokeIfNotRunningAndToggleWorkspace}"
|
||||
) keys)
|
||||
))
|
||||
lib.flatten
|
||||
];
|
||||
fixScratchpad._var = lib.generators.mkLuaInline ''
|
||||
function(scratchpad, window, monitor_)
|
||||
local monitor = monitor_
|
||||
if monitor == nil then
|
||||
monitor = window.monitor
|
||||
end
|
||||
|
||||
windowrulev2 = lib.pipe scratchpads [
|
||||
(map ({ class, size, ... }: [
|
||||
"workspace special:${class}Ws, class:^(${class})$"
|
||||
"float, class:^${class}$"
|
||||
"size ${toString size.w}% ${toString size.h}%, class:^(${class})$"
|
||||
"move ${toString ((100 - size.w) / 2)}% ${toString ((100 - size.h) / 2)}%, class:^(${class})$"
|
||||
]))
|
||||
lib.flatten
|
||||
local scaled_w = monitor.width * (1/monitor.scale)
|
||||
local scaled_h = monitor.height * (1/monitor.scale)
|
||||
|
||||
-- I have no idea why these need to be run twice, but despite the values being the same,
|
||||
-- it somehow always misplaces the window the first time around...
|
||||
hl.dispatch(hl.dsp.window.move({
|
||||
x = monitor.x + (scaled_w * (((100 -scratchpad.size.w) / 2) / 100)),
|
||||
y = monitor.y + (scaled_h * (((100 -scratchpad.size.h) / 2) / 100)),
|
||||
relative = false
|
||||
}))
|
||||
hl.dispatch(hl.dsp.window.resize({
|
||||
x = scaled_w * scratchpad.size.w / 100,
|
||||
y = scaled_h * scratchpad.size.h / 100,
|
||||
relative = false
|
||||
}))
|
||||
hl.dispatch(hl.dsp.window.move({
|
||||
x = monitor.x + (scaled_w * (((100 -scratchpad.size.w) / 2) / 100)),
|
||||
y = monitor.y + (scaled_h * (((100 -scratchpad.size.h) / 2) / 100)),
|
||||
relative = false
|
||||
}))
|
||||
hl.dispatch(hl.dsp.window.resize({
|
||||
x = scaled_w * scratchpad.size.w / 100,
|
||||
y = scaled_h * scratchpad.size.h / 100,
|
||||
relative = false
|
||||
}))
|
||||
end
|
||||
'';
|
||||
|
||||
invokeScratchpad._var = lib.generators.mkLuaInline ''
|
||||
function(scratchpad)
|
||||
local scratchpad_window = hl.get_window("class:^(" .. scratchpad.class .. ")$")
|
||||
local current_workspace = hl.get_active_workspace()
|
||||
|
||||
if scratchpad_window == nil then
|
||||
hl.dispatch(hl.dsp.exec_cmd(scratchpad.command, {
|
||||
workspace = current_workspace.id
|
||||
}))
|
||||
else
|
||||
hl.dispatch(hl.dsp.focus({ window = scratchpad_window }))
|
||||
|
||||
if scratchpad_window.workspace.id ~= current_workspace.id then
|
||||
hl.dispatch(hl.dsp.window.move({ workspace = current_workspace.id }))
|
||||
fixScratchpad(scratchpad, scratchpad_window, current_workspace.monitor)
|
||||
else
|
||||
hl.dispatch(hl.dsp.window.move({ workspace = "special:" .. scratchpad.class .. "Ws", follow = false }))
|
||||
end
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
bind = lib.concatLists (lib.imap1 (i: { keys, command, class, size, ... }: map (key: {
|
||||
_args = [
|
||||
key
|
||||
(lib.generators.mkLuaInline "function() invokeScratchpad(scratchpads[${toString i}]) end")
|
||||
];
|
||||
}) keys) scratchpads);
|
||||
|
||||
window_rule = map ({ class, size, ... }: {
|
||||
name = "scratchpad_${class}";
|
||||
match.class = "^(${class})$";
|
||||
|
||||
float = true;
|
||||
size = [
|
||||
"(monitor_w*${toString (size.w / 100.0)})"
|
||||
"(monitor_h*${toString (size.h / 100.0)})"
|
||||
];
|
||||
move = [
|
||||
"(monitor_w*${toString (((100 - size.w) / 2) / 100.0)})"
|
||||
"(monitor_h*${toString (((100 - size.h) / 2) / 100.0)})"
|
||||
];
|
||||
}) scratchpads;
|
||||
|
||||
# TODO: fix me
|
||||
on._args = [
|
||||
"workspace.move_to_monitor"
|
||||
(lib.mkLuaInline ''
|
||||
function(workspace, monitor)
|
||||
for _, scratchpad in pairs(scratchpads) do
|
||||
local scratchpad_window = hl.get_window("class:^(" .. scratchpad.class .. ")$")
|
||||
if scratchpad_window == nil or scratchpad_window.workspace.id ~= workspace.id then
|
||||
-- NOTE: crazy that there's no continue in lua...
|
||||
goto continue
|
||||
end
|
||||
|
||||
-- hl.notification.create({
|
||||
-- time = 3000,
|
||||
-- text = "Fixing scratchpad " .. scratchpad.class .. " to monitor " .. monitor.name
|
||||
-- })
|
||||
|
||||
fixScratchpad(scratchpad, scratchpad_window, monitor)
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
'')
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,38 +4,111 @@ let
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
wayland.windowManager.hyprland.settings.windowrulev2 = [
|
||||
"float, class:^(Rofi)$"
|
||||
"float, class:^(xdg-desktop-portal-gtk)$"
|
||||
"float, title:^(.*Bitwarden Password Manager.*)$"
|
||||
"float, title:^(Picture-in-Picture)$"
|
||||
"tile, class:^(Nsxiv)$"
|
||||
wayland.windowManager.hyprland.settings.window_rule = [
|
||||
{
|
||||
match.class = "^(Rofi)$";
|
||||
float = true;
|
||||
}
|
||||
{
|
||||
match.class = "^(xdg-desktop-portal-gtk)$";
|
||||
float = true;
|
||||
}
|
||||
{
|
||||
match.title = "^(.*Bitwarden Password Manager.*)$";
|
||||
float = true;
|
||||
}
|
||||
{
|
||||
match.title = "^(Picture-in-Picture)$";
|
||||
float = true;
|
||||
}
|
||||
{
|
||||
match.class = "^(Nsxiv)$";
|
||||
tile = true;
|
||||
}
|
||||
|
||||
"float, class: ^(Gimp-2.*)$, title:^(Open Image)$"
|
||||
"size 70%, class: ^(Gimp-2.*)$, title:^(Open Image)$"
|
||||
"center, class: ^(Gimp-2.*)$, title:^(Open Image)$"
|
||||
{
|
||||
match.class = "^(Gimp-2.*)$";
|
||||
match.title = "^(Open Image)$";
|
||||
|
||||
"dimaround, class:^(xdg-desktop-portal-gtk)$"
|
||||
float = true;
|
||||
size = [
|
||||
"70%"
|
||||
"70%"
|
||||
];
|
||||
center = true;
|
||||
}
|
||||
# {
|
||||
# match.class = "^(xdg-desktop-portal-gtk)$";
|
||||
# dimaround = true;
|
||||
# }
|
||||
|
||||
"workspace special silent, title:^(Firefox — Sharing Indicator)$"
|
||||
"workspace special silent, title:^(Zen — Sharing Indicator)$"
|
||||
"workspace special silent, title:^(.*is sharing (your screen|a window)\.)$"
|
||||
{
|
||||
match.title = "^(Firefox — Sharing Indicator)$";
|
||||
workspace = "special:silent";
|
||||
}
|
||||
{
|
||||
match.title = "^(Zen — Sharing Indicator)$";
|
||||
workspace = "special:silent";
|
||||
}
|
||||
{
|
||||
match.title = "^(.*is sharing (your screen|a window)\\.)$";
|
||||
workspace = "special:silent";
|
||||
}
|
||||
|
||||
"workspace 2, class:^(firefox)$"
|
||||
"workspace 2, class:^(chromium)$"
|
||||
{
|
||||
}
|
||||
|
||||
"workspace 3, class:^(Emacs)$"
|
||||
"workspace 3, class:^(code)$"
|
||||
"workspace 3, class:^(code-url-handler)$"
|
||||
"workspace 3, class:^(dev.zed.Zed)$"
|
||||
{
|
||||
match.class = "^(firefox)$";
|
||||
workspace = 2;
|
||||
}
|
||||
{
|
||||
match.class = "^(chromium)$";
|
||||
workspace = 2;
|
||||
}
|
||||
|
||||
"workspace 5, class:^(discord)$"
|
||||
"workspace 5, class:^(Element)$"
|
||||
{
|
||||
match.class = "^(Emacs)$";
|
||||
workspace = 3;
|
||||
}
|
||||
{
|
||||
match.class = "^(code)$";
|
||||
workspace = 3;
|
||||
}
|
||||
{
|
||||
match.class = "^(code-url-handler)$";
|
||||
workspace = 3;
|
||||
}
|
||||
{
|
||||
match.class = "^(dev.zed.Zed)$";
|
||||
workspace = 3;
|
||||
}
|
||||
|
||||
"float, class:^(xdg-desktop-portal-termfilechooser)$"
|
||||
"float, class:^(anyrun)$"
|
||||
"size 70% 80%, class:^(xdg-desktop-portal-termfilechooser)$"
|
||||
"move 15% 10%, class:^(xdg-desktop-portal-termfilechooser)$"
|
||||
{
|
||||
match.class = "^(discord)$";
|
||||
workspace = 5;
|
||||
}
|
||||
{
|
||||
match.class = "^(Element)$";
|
||||
workspace = 5;
|
||||
}
|
||||
|
||||
{
|
||||
match.class = "^(anyrun)$";
|
||||
float = true;
|
||||
}
|
||||
{
|
||||
match.class = "^(xdg-desktop-portal-termfilechooser)$";
|
||||
float = true;
|
||||
size = [
|
||||
"70%"
|
||||
"80%"
|
||||
];
|
||||
move = [
|
||||
"15%"
|
||||
"10%"
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,18 +6,18 @@
|
||||
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
monitor = [
|
||||
"eDP-1, 3840x2400@90.00Hz, 0x0, 2"
|
||||
# "eDP-1, 3840x2400@90.00Hz, 0x0, 2"
|
||||
|
||||
# Office, childhood home
|
||||
"desc:Dell Inc. DELL U2713H C6F0K52E19AL, 2560x1440, 1920x0, 1"
|
||||
"desc:Dell Inc. DELL U2713H C6F0K3CH0MUL, 2560x1440, ${toString (1920 + 2560)}x0, 1"
|
||||
# # Office, childhood home
|
||||
# "desc:Dell Inc. DELL U2713H C6F0K52E19AL, 2560x1440, 1920x0, 1"
|
||||
# "desc:Dell Inc. DELL U2713H C6F0K3CH0MUL, 2560x1440, ${toString (1920 + 2560)}x0, 1"
|
||||
|
||||
# PVV
|
||||
"desc:ASUSTek COMPUTER INC MG248 K2LMQS048969, 1920x1080@60.00Hz, -1920x0, 1"
|
||||
"desc:Ancor Communications Inc MG248 G7LMQS010063, 1920x1080@60.00Hz, -${toString (1920 * 2)}x0, 1"
|
||||
# # PVV
|
||||
# "desc:ASUSTek COMPUTER INC MG248 K2LMQS048969, 1920x1080@60.00Hz, -1920x0, 1"
|
||||
# "desc:Ancor Communications Inc MG248 G7LMQS010063, 1920x1080@60.00Hz, -${toString (1920 * 2)}x0, 1"
|
||||
|
||||
# Home office
|
||||
"desc:LG Electronics LG SMART UHD 0x000BC43F, 3840x2160@60.00Hz, 1920x0, 1.5"
|
||||
# # Home office
|
||||
# "desc:LG Electronics LG SMART UHD 0x000BC43F, 3840x2160@60.00Hz, 1920x0, 1.5"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user