From 66bb8a296ec232f4fe4c02bcb80f6373eaedb5c2 Mon Sep 17 00:00:00 2001 From: Wekuz Date: Thu, 28 May 2026 23:31:52 +0300 Subject: [PATCH] Migrate Hyprland config to Lua --- dot_config/hypr/dot_luarc.json | 7 + dot_config/hypr/hyprland.conf.tmpl | 362 ------------------------- dot_config/hypr/hyprland.lua.tmpl | 411 +++++++++++++++++++++++++++++ 3 files changed, 418 insertions(+), 362 deletions(-) create mode 100644 dot_config/hypr/dot_luarc.json delete mode 100644 dot_config/hypr/hyprland.conf.tmpl create mode 100644 dot_config/hypr/hyprland.lua.tmpl diff --git a/dot_config/hypr/dot_luarc.json b/dot_config/hypr/dot_luarc.json new file mode 100644 index 0000000..b4ecec0 --- /dev/null +++ b/dot_config/hypr/dot_luarc.json @@ -0,0 +1,7 @@ +{ + "workspace": { + "library": [ + "/usr/share/hypr/stubs" + ] + } +} diff --git a/dot_config/hypr/hyprland.conf.tmpl b/dot_config/hypr/hyprland.conf.tmpl deleted file mode 100644 index 4d3fcc8..0000000 --- a/dot_config/hypr/hyprland.conf.tmpl +++ /dev/null @@ -1,362 +0,0 @@ -################ -### MONITORS ### -################ - -{{- if eq .chezmoi.hostname "wkz-pc" }} -monitor = DP-2, 3840x2160@160, 0x0, 1.5, bitdepth,10 -{{- else if eq .chezmoi.hostname "wkz-lapdog" }} -monitor = eDP-1, 1920x1080@60, 0x0, 1.33 -{{- else }} -monitor = , preferred, auto, auto -{{- end }} - -xwayland { - force_zero_scaling = true -} - -################### -### MY PROGRAMS ### -################### - -$terminal = uwsm-app -- kitty -$browser = uwsm-app -- zen-browser -$hyprlock = uwsm-app -- hyprlock -$hyprshot = uwsm-app -- hyprshot -z - -################# -### AUTOSTART ### -################# - -exec-once = uwsm-app -- udiskie -exec-once = uwsm-app -- waybar -exec-once = uwsm-app -- dunst -exec-once = uwsm-app -- wl-paste --watch cliphist store -exec-once = uwsm-app -- hypridle -exec-once = uwsm-app -- hyprpaper -exec-once = uwsm-app -- hyprsunset -exec-once = [workspace 1] uwsm-app -- $terminal -exec-once = [workspace 2 silent] uwsm-app -- $browser -{{- if eq .chezmoi.hostname "wkz-lapdog" }} -exec-once = uwsm-app -- iio-hyprland -{{- end }} - -############################# -### ENVIRONMENT VARIABLES ### -############################# - -# See https://wiki.hyprland.org/Configuring/Environment-variables/ - -# Environment variables stored in ~/.config/uwsm/env and ~/.config/uwsm/env-hyprland - -##################### -### LOOK AND FEEL ### -##################### - -# Refer to https://wiki.hyprland.org/Configuring/Variables/ - -# https://wiki.hyprland.org/Configuring/Variables/#general -general { - gaps_in = 0 - gaps_out = 0 - - border_size = 1 - - col.active_border = rgba(00dd00ff) rgba(006600ff) 90deg - col.inactive_border = rgba(646464ff) - - # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on - allow_tearing = true - - {{- if eq .hyprlandLayout "dwindle" }} - layout = dwindle - {{- else if eq .hyprlandLayout "scrolling" }} - layout = scrolling - {{- end }} - - snap { - enabled = true - window_gap = 4 - monitor_gap = 6 - respect_gaps = true - } -} - -# https://wiki.hyprland.org/Configuring/Variables/#decoration -decoration { - rounding = 0 - - active_opacity = 1.0 - inactive_opacity = 1.0 - - shadow { - enabled = false - range = 4 - render_power = 3 - color = rgba(151515ee) - } - - # https://wiki.hyprland.org/Configuring/Variables/#blur - blur { - enabled = false - size = 3 - passes = 1 - - vibrancy = 0.1696 - } -} - -# https://wiki.hyprland.org/Configuring/Variables/#animations -animations { - enabled = yes - - # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more - - bezier = easeOutQuint,0.23,1,0.32,1 - bezier = easeInOutCubic,0.65,0.05,0.36,1 - bezier = linear,0,0,1,1 - bezier = almostLinear,0.5,0.5,0.75,1.0 - bezier = quick,0.15,0,0.1,1 - - animation = windows, 1, 1, quick - animation = windowsOut, 1, 0.5, linear, slide - animation = layers, 1, 1, quick - animation = fade, 0, 2, linear - animation = fadeDpms, 1, 4, linear - animation = fadeLayersOut, 0, 1, almostLinear - animation = workspacesIn, 1, 0.5, quick - animation = workspacesOut, 1, 0.7, quick -} - -# Smart gaps: https://wiki.hyprland.org/Configuring/Workspace-Rules/#smart-gaps - -# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more -dwindle { - preserve_split = true -} - -# See https://wiki.hyprland.org/Configuring/Scrolling-Layout/ for more -scrolling { - direction = right -} - -# https://wiki.hyprland.org/Configuring/Variables/#misc -misc { - disable_hyprland_logo = true - vrr = 2 - enable_swallow = true - swallow_regex = ^(kitty)$ - swallow_exception_regex = ^(xev|wev|vkcube|glxgears|kitty).* - allow_session_lock_restore = 1 - on_focus_under_fullscreen = 1 -} - -ecosystem { - enforce_permissions = true -} - -permission = /usr/bin/grim, screencopy, allow -permission = /usr/bin/hyprlock, screencopy, allow -permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow - -############# -### INPUT ### -############# - -# https://wiki.hyprland.org/Configuring/Variables/#input -input { - kb_layout = ee - kb_variant = - kb_model = -{{- if eq .chezmoi.hostname "wkz-lapdog" }} - kb_options = caps:swapescape, fkeys:basic_13-24 -{{- else }} - kb_options = fkeys:basic_13-24 -{{- end }} - kb_rules = - - follow_mouse = 1 - - sensitivity = -0.05 # -1.0 - 1.0, 0 means no modification. - - touchpad { - natural_scroll = true - scroll_factor = 0.6 - disable_while_typing = false - } -} - -device { - name = falbatech-redox - kb_layout = us - kb_options = fkeys:basic_13-24 -} - -device { - name = falbatech-redox-mouse - sensitivity = -0.5 - accel_profile = flat -} -{{- if eq .chezmoi.hostname "wkz-lapdog" }} - -device { - name = hp-active-pen-g3-keyboard - kb_layout = us - kb_options = -} -{{- end }} - -# https://wiki.hyprland.org/Configuring/Variables/#gestures -gestures { - gesture = 3, horizontal, workspace - gesture = 3, up, mod: SUPER, fullscreen -} - -################### -### KEYBINDINGS ### -################### - -# See https://wiki.hyprland.org/Configuring/Keywords/ -$mainMod = SUPER - -bind = $mainMod, RETURN, exec, $terminal -bind = $mainMod, Q, exec, $browser -bind = $mainMod, W, killactive, -bind = $mainMod CTRL SHIFT, Q, exit, -bind = $mainMod, C, togglefloating, -bind = $mainMod, SPACE, exec, pkill fuzzel || uwsm-app -- fuzzel -bind = $mainMod SHIFT, J, layoutmsg, togglesplit -bind = $mainMod, F, fullscreen, 1 -bind = $mainMod SHIFT, F, fullscreen, 0 -# Hyprlock -bind = $mainMod CTRL ALT, L, exec, $hyprlock -# Cliphist -bind = $mainMod, V, exec, pkill fuzzel || cliphist list | uwsm-app -- fuzzel -d -w 75 --select-index 1 | cliphist decode | wl-copy -# Hyprshot -bind = $mainMod SHIFT, S, exec, $hyprshot -m region --clipboard-only -bind = $mainMod SHIFT CTRL, S, exec, $hyprshot -m window --clipboard-only -bind = $mainMod SHIFT ALT, S, exec, $hyprshot -m output --clipboard-only -bind = $mainMod SHIFT, B, exec, pkill fuzzel || bluetoothctl -- connect "$(bluetoothctl -- devices Paired | cut -f2- -d ' ' | uwsm-app -- fuzzel -d -l 8 | cut -f1 -d ' ')" -bind = $mainMod SHIFT, A, exec, ~/scripts/select-audio-sink.sh - -# Move focus -{{- if eq .hyprlandLayout "dwindle" }} -bind = $mainMod, H, movefocus, l -bind = $mainMod, L, movefocus, r -bind = $mainMod, J, movefocus, d -bind = $mainMod, K, movefocus, u -{{- else if eq .hyprlandLayout "scrolling" }} -bind = $mainMod, H, layoutmsg, move -col -bind = $mainMod, L, layoutmsg, move +col -{{- end }} - -# Switch workspaces -bind = $mainMod, 1, workspace, 1 -bind = $mainMod, 2, workspace, 2 -bind = $mainMod, 3, workspace, 3 -bind = $mainMod, 4, workspace, 4 -bind = $mainMod, 5, workspace, 5 -bind = $mainMod, 6, workspace, 6 -bind = $mainMod, 7, workspace, 7 -bind = $mainMod, 8, workspace, 8 -bind = $mainMod, 9, workspace, 9 -bind = $mainMod, 0, workspace, 10 - -# Move active window to a workspace -bind = $mainMod SHIFT, 1, movetoworkspace, 1 -bind = $mainMod SHIFT, 2, movetoworkspace, 2 -bind = $mainMod SHIFT, 3, movetoworkspace, 3 -bind = $mainMod SHIFT, 4, movetoworkspace, 4 -bind = $mainMod SHIFT, 5, movetoworkspace, 5 -bind = $mainMod SHIFT, 6, movetoworkspace, 6 -bind = $mainMod SHIFT, 7, movetoworkspace, 7 -bind = $mainMod SHIFT, 8, movetoworkspace, 8 -bind = $mainMod SHIFT, 9, movetoworkspace, 9 -bind = $mainMod SHIFT, 0, movetoworkspace, 10 - -bind = $mainMod SHIFT CTRL, TAB, movecurrentworkspacetomonitor, +1 - -# Move/resize windows -bindm = $mainMod, mouse:272, movewindow -bindm = $mainMod, mouse:273, resizewindow -{{- if eq .hyprlandLayout "scrolling" }} -bind = $mainMod SHIFT, H, layoutmsg, swapcol l -bind = $mainMod SHIFT, L, layoutmsg, swapcol r -bind = $mainMod, J, layoutmsg, colresize -conf -bind = $mainMod SHIFT, J, layoutmsg, colresize -0.1 -bind = $mainMod, K, layoutmsg, colresize +conf -bind = $mainMod SHIFT, K, layoutmsg, colresize +0.1 -{{- end }} -bind = $mainMod ALT, P, pin, active - -# Laptop multimedia keys for volume and LCD brightness -bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ && ~/scripts/volume-control.sh -bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- && ~/scripts/volume-control.sh -bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && ~/scripts/volume-control.sh -bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle -bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+ -bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%- - -# Requires playerctl -bindl = , XF86AudioNext, exec, playerctl next -bindl = , XF86AudioPause, exec, playerctl play-pause -bindl = , XF86AudioPlay, exec, playerctl play-pause -bindl = , XF86AudioPrev, exec, playerctl previous - -# Laptop lid -bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "HDMI-A-1, 1920x1080@120, 0x0, 1" -bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable" -bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 1920x1080@60, 0x0, 1.25" -bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "HDMI-A-1, disable" -{{- if eq .chezmoi.hostname "wkz-lapdog" }} - -# Stylus -bind = SUPER, F20, sendshortcut, CTRL, Z, active # Single-click -bind = SUPER, F19, sendshortcut, CTRL SHIFT, Z, active # Double-click -bind = SUPER, F18, exec, pkill wvkbd-deskintl || uwsm-app -- wvkbd-deskintl # Press & hold -{{- end }} - -############################## -### WINDOWS AND WORKSPACES ### -############################## - -# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more -# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules - -# No border when only 1 window or window is fullscreen -windowrule = match:workspace w[1], match:class negative:^(steam)$, match:title negative:Steam, border_size 0 -windowrule = match:workspace f[1-2], border_size 0 - -windowrule { - name = pavucontrol-float - match:class = ^(org.pulseaudio.pavucontrol)$ - match:title = ^(Volume Control)$ - - float = 1 - center = 1 - size = (0.35*monitor_w) (0.4*monitor_h) -} - -windowrule { - name = showmethekey-float - match:class = ^(showmethekey-gtk)$ - - float = 1 - border_size = 0 -} - -windowrule { - name = steam-popup-float - match:class = ^(steam)$ - match:title = negative:Steam - - float = 1 -} - -windowrule { - name = gaming - match:class = ^(steam_app_\d+|cs2)$ - - workspace = 10 - immediate = 1 - fullscreen = 1 -} diff --git a/dot_config/hypr/hyprland.lua.tmpl b/dot_config/hypr/hyprland.lua.tmpl new file mode 100644 index 0000000..770e689 --- /dev/null +++ b/dot_config/hypr/hyprland.lua.tmpl @@ -0,0 +1,411 @@ +---------------- +--- MONITORS --- +---------------- + +-- https://wiki.hypr.land/Configuring/Basics/Monitors + +{{- if eq .chezmoi.hostname "wkz-pc" }} +hl.monitor({ + output = "DP-2", + mode = "3840x2160@160", + position = "0x0", + scale = 1.5, + bitdepth = 10 +}) +{{- else if eq .chezmoi.hostname "wkz-lapdog" }} +hl.monitor({ + output = "eDP-1", + mode = "1920x1080@60", + position = "0x0", + scale = 1.33 +}) +{{- else }} +hl.monitor({ + output = "", + mode = "preferred", + position = "auto", + scale = 1 +}) +{{- end }} + +------------------- +--- MY PROGRAMS --- +------------------- + +local terminal = "uwsm-app -- kitty" +local browser = "uwsm-app -- zen-browser" +local hyprlock = "uwsm-app -- hyprlock" +local hyprshot = "uwsm-app -- hyprshot -z" + +----------------- +--- AUTOSTART --- +----------------- + +hl.on("hyprland.start", function() + hl.exec_cmd("uwsm-app -- udiskie") + hl.exec_cmd("uwsm-app -- waybar") + hl.exec_cmd("uwsm-app -- dunst") + hl.exec_cmd("uwsm-app -- wl-paste --watch cliphist store") + hl.exec_cmd("uwsm-app -- hypridle") + hl.exec_cmd("uwsm-app -- hyprpaper") + hl.exec_cmd("uwsm-app -- hyprsunset") + hl.exec_cmd("[workspace 1] uwsm-app -- " .. terminal) + hl.exec_cmd("[workspace 2 silent] uwsm-app -- " .. browser) + {{- if eq .chezmoi.hostname "wkz-lapdog" }} + hl.exec_cmd("uwsm-app -- iio-hyprland") + {{- end }} +end) + +----------------------------- +--- ENVIRONMENT VARIABLES --- +----------------------------- + +-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables + +-- Environment variables stored in ~/.config/uwsm/env and ~/.config/uwsm/env-hyprland + +--------------------- +--- LOOK AND FEEL --- +--------------------- + +-- Refer to https://wiki.hypr.land/Configuring/Basics/Variables + +hl.config({ + -- https://wiki.hypr.land/Configuring/Basics/Variables/#general + general = { + border_size = 1, + gaps_in = 0, + gaps_out = 0, + + col = { + inactive_border = "rgba(646464ff)", + active_border = { + colors = { + "rgba(00dd00ff)", + "rgba(006600ff)" + }, + angle = 90 + } + }, + + {{- if eq .hyprlandLayout "dwindle" }} + layout = "dwindle", + {{- else if eq .hyprlandLayout "scrolling" }} + layout = "scrolling", + {{- end }} + + -- Please see https://wiki.hypr.land/Configuring/Advanced-and-Cool/Tearing before you turn this on + allow_tearing = true, + + snap = { + enabled = true, + window_gap = 4, + monitor_gap = 6, + respect_gaps = true + } + }, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#decoration + decoration = { + rounding = 0, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#shadow + shadow = { + enabled = false, + color = "rgba(151515ee)" + }, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#blur + blur = { + enabled = false + } + }, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#animations + animations = { + enabled = true + } +}) + +------------------ +--- ANIMATIONS --- +------------------ + +-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Animations + +hl.curve("easeOutQuint", { type = "bezier", points = { { 0.23, 1 }, { 0.32, 1 } } }) +hl.curve("easeInOutCubic", { type = "bezier", points = { { 0.65, 0.05 }, { 0.36, 1 } } }) +hl.curve("linear", { type = "bezier", points = { { 0, 0 }, { 1, 1 } } }) +hl.curve("almostLinear", { type = "bezier", points = { { 0.5, 0.5 }, { 0.75, 1.0 } } }) +hl.curve("quick", { type = "bezier", points = { { 0.15, 0 }, { 0.1, 1 } } }) + +hl.animation({ leaf = "windows", enabled = true, speed = 1, bezier = "quick" }) +hl.animation({ leaf = "windowsOut", enabled = true, speed = 0.5, bezier = "quick", style = "slide" }) +hl.animation({ leaf = "layers", enabled = true, speed = 1, bezier = "quick" }) +hl.animation({ leaf = "fade", enabled = true, speed = 2, bezier = "linear" }) +hl.animation({ leaf = "fadeDpms", enabled = true, speed = 4, bezier = "linear" }) +hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = 1, bezier = "almostLinear" }) +hl.animation({ leaf = "workspacesIn", enabled = true, speed = 0.5, bezier = "quick" }) +hl.animation({ leaf = "workspacesOut", enabled = true, speed = 0.7, bezier = "quick" }) + +hl.config({ + -- https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout + dwindle = { + preserve_split = true + }, + + -- https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout + scrolling = { + direction = "right" + }, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#input + input = { + kb_layout = "ee", + {{- if eq .chezmoi.hostname "wkz-lapdog" }} + kb_options = "caps:swapescape, fkeys:basic_13-24", + {{- else }} + kb_options = "fkeys:basic_13-24", + {{- end }} + + sensitivity = -0.05, -- -1.0 - 1.0, 0 means no modification + + follow_mouse = 1, + + touchpad = { + disable_while_typing = false, + natural_scroll = true, + scroll_factor = 0.6 + } + } +}) + +-- https://wiki.hypr.land/Configuring/Basics/Variables/#per-device-input-config + +hl.device({ + name = "falbatech-redox", + kb_layout = "us", + kb_options = "fkeys:basic_13-24" +}) + +hl.device({ + name = "falbatech-redox-mouse", + sensitivity = -0.5, + accel_profile = "flat" +}) +{{- if eq .chezmoi.hostname "wkz-lapdog" }} + +hl.device({ + name = "hp-active-pen-g3-keyboard", + kb_layout = "us", + kb_options = "" +}) +{{- end }} + +-- https://wiki.hypr.land/Configuring/Advanced-and-Cool/Gestures + +hl.gesture({ + fingers = 3, + direction = "horizontal", + action = "workspace" +}) + +hl.gesture({ + fingers = 3, + direction = "up", + mods = "SUPER", + action = "fullscreen" +}) + +hl.config({ + -- https://wiki.hypr.land/Configuring/Basics/Variables/#misc + misc = { + disable_hyprland_logo = true, + + vrr = 2, + + mouse_move_enables_dpms = true, + key_press_enables_dpms = true, + + enable_swallow = true, + swallow_regex = "^(kitty)$", + swallow_exception_regex = "^(xev|wev|vkcube|glxgears|kitty).*", + + allow_session_lock_restore = true, + + on_focus_under_fullscreen = 1 + }, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#xwayland + xwayland = { + force_zero_scaling = true + }, + + -- https://wiki.hypr.land/Configuring/Basics/Variables/#ecosystem + ecosystem = { + enforce_permissions = true + } +}) + +hl.permission({ binary = "/usr/bin/grim", type = "screencopy", mode = "allow" }) +hl.permission({ binary = "/usr/bin/hyprlock", type = "screencopy", mode = "allow" }) +hl.permission({ binary = "/usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland", type = "screencopy", mode = "allow" }) + +------------------- +--- KEYBINDINGS --- +------------------- + +-- https://wiki.hypr.land/Configuring/Basics/Binds + +hl.bind("SUPER + RETURN", hl.dsp.exec_cmd(terminal)) +hl.bind("SUPER + Q", hl.dsp.exec_cmd(browser)) +hl.bind("SUPER + W", hl.dsp.window.close()) +hl.bind("SUPER + SHIFT + ALT + Q", hl.dsp.exit()) +hl.bind("SUPER + C", hl.dsp.window.float({ action = "toggle" })) +hl.bind("SUPER + SPACE", hl.dsp.exec_cmd("pkill fuzzel || uwsm-app -- fuzzel")) +hl.bind("SUPER + SHIFT + J", hl.dsp.layout("togglesplit")) +hl.bind("SUPER + F", hl.dsp.window.fullscreen({ mode = "maximized" })) +hl.bind("SUPER + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen" })) +-- Hyprlock +hl.bind("SUPER + CTRL + ALT + L", hl.dsp.exec_cmd(hyprlock)) +-- Cliphist +hl.bind("SUPER + V", hl.dsp.exec_cmd("pkill fuzzel || cliphist list | uwsm-app -- fuzzel -d -w 75 --select-index 1 | cliphist decode | wl-copy")) +-- Hyprshot +hl.bind("SUPER + SHIFT + S", hl.dsp.exec_cmd(hyprshot .. "-m region --clipboard-only")) +hl.bind("SUPER + SHIFT + CTRL + S", hl.dsp.exec_cmd(hyprshot .. "-m window --clipboard-only")) +hl.bind("SUPER + SHIFT + ALT + S", hl.dsp.exec_cmd(hyprshot .. "-m output --clipboard-only")) +hl.bind("SUPER + SHIFT + B", +hl.dsp.exec_cmd("pkill fuzzel || bluetoothctl -- connect \"$(bluetoothctl -- devices Paired | cut -f2- -d ' ' | uwsm-app -- fuzzel -d -l 8 | cut -f1 -d ' ')\"")) +hl.bind("SUPER + SHIFT + A", hl.dsp.exec_cmd("sh ~/scripts/select-audio-sink.sh")) + +-- Move focus +{{- if eq .hyprlandLayout "dwindle" }} +hl.bind("SUPER + H", hl.dsp.focus({ direction = "left" })) +hl.bind("SUPER + L", hl.dsp.focus({ direction = "right" })) +hl.bind("SUPER + J", hl.dsp.focus({ direction = "down" })) +hl.bind("SUPER + K", hl.dsp.focus({ direction = "up" })) +{{- else if eq .hyprlandLayout "scrolling" }} +hl.bind("SUPER + H", hl.dsp.layout("move -col")) +hl.bind("SUPER + L", hl.dsp.layout("move +col")) +{{- end }} + +for i = 1, 10 do + local key = i % 10 -- 10 maps to key 0 + -- Switch workspaces + hl.bind("SUPER + " .. key, hl.dsp.focus({ workspace = i })) + -- Move active window to a workspace + hl.bind("SUPER + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) +end + +hl.bind("SUPER + SHIFT + CTRL + TAB", hl.dsp.workspace.move({ monitor = "+1" })) + +-- Move/resize windows +hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true }) +{{- if eq .hyprlandLayout "scrolling" }} +hl.bind("SUPER + SHIFT + H", hl.dsp.layout("swapcol l")) +hl.bind("SUPER + SHIFT + L", hl.dsp.layout("swapcol r")) +hl.bind("SUPER + J", hl.dsp.layout("colresize -conf")) +hl.bind("SUPER + SHIFT + J", hl.dsp.layout("colresize -0.1")) +hl.bind("SUPER + K", hl.dsp.layout("colresize +conf")) +hl.bind("SUPER + SHIFT + K", hl.dsp.layout("colresize +0.1")) +{{- end }} + +hl.bind("SUPER + ALT + P", hl.dsp.window.pin()) + +-- Laptop multimedia keys for volume and LCD brightness +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+ && ~/scripts/volume-control.sh"), { locked = true, repeating = true }) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%- && ~/scripts/volume-control.sh"), { locked = true, repeating = true }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && ~/scripts/volume-control.sh"), { locked = true, repeating = true }) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl s 5%+"), { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessDown",hl.dsp.exec_cmd("brightnessctl s 5%-"), { locked = true, repeating = true }) + +-- Requires playerctl +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) +hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) + +{{- if eq .chezmoi.hostname "wkz-lapdog" }} + +-- Stylus +hl.bind("SUPER + F20", hl.dsp.send_shortcut({mods = "CTRL", key = "Z"})) -- Single-click +hl.bind("SUPER + F19", hl.dsp.send_shortcut({mods = "CTRL + SHIFT", key = "Z"})) -- Double-click +hl.bind("SUPER + F18", hl.dsp.exec_cmd("pkill wvkbd-deskintl || uwsm-app -- wvkbd-deskintl")) -- Press & hold +{{- end }} + +------------------------------ +--- WINDOWS AND WORKSPACES --- +------------------------------ + +-- https://wiki.hypr.land/Configuring/Basics/Window-Rules +-- https://wiki.hypr.land/Configuring/Basics/Workspace-Rules + +-- No border when only 1 window +hl.window_rule({ + name = "no-border-single-window", + match = { + workspace = "w[1]", + class = "negative:^(steam)$", + title = "negative:Steam" + }, + + border_size = 0 +}) + +-- No border when window is fullscreen +hl.window_rule({ + name = "no-border-fullscreen", + match = { + workspace = "f[1-2]", + }, + + border_size = 0 +}) + +hl.window_rule({ + name = "pavucontrol-float", + match = { + class = "^(org.pulseaudio.pavucontrol)$", + title = "^(Volume Control)$", + }, + + float = 1, + center = 1, + size = { + "0.35*monitor_w", + "0.4*monitor_h", + }, +}) + +hl.window_rule({ + name = "showmethekey-float", + match = { + class = "^(showmethekey-gtk)$", + }, + + float = 1, + border_size = 0, +}) + +hl.window_rule({ + name = "steam-popup-float", + match = { + class = "^(steam)$", + title = "negative:Steam", + }, + + float = 1, +}) + +hl.window_rule({ + name = "gaming", + match = { + class = "^(steam_app_\\d+|cs2)$", + }, + + workspace = 10, + immediate = 1, + fullscreen = 1, +})