From 5bd01aa47ddd55dc888dbb30bae110ebb4d2a395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20P=C3=A1rk=C3=A1nyi?= Date: Mon, 24 Aug 2026 00:50:01 +0200 Subject: [PATCH] finally refactor to lua. Also neat things WIP --- hypr/exec.lua | 3 ++ hypr/hyprland.lua | 101 +++++++++++++++++++++++++++++++++++++++++++++ hypr/keybinds.lua | 77 ++++++++++++++++++++++++++++++++++ hypr/macchiato.lua | 81 ++++++++++++++++++++++++++++++++++++ 4 files changed, 262 insertions(+) create mode 100644 hypr/exec.lua create mode 100644 hypr/hyprland.lua create mode 100644 hypr/keybinds.lua create mode 100644 hypr/macchiato.lua diff --git a/hypr/exec.lua b/hypr/exec.lua new file mode 100644 index 0000000..1cf33af --- /dev/null +++ b/hypr/exec.lua @@ -0,0 +1,3 @@ +hl.exec_cmd("dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP DISPLAY") +hl.exec_cmd("uwsm app udiskie") +hl.exec_cmd("uwsm app kdeconnect-indicator") diff --git a/hypr/hyprland.lua b/hypr/hyprland.lua new file mode 100644 index 0000000..884349a --- /dev/null +++ b/hypr/hyprland.lua @@ -0,0 +1,101 @@ +local monitors = { + { + output="DP-2", -- todo: description as ID + mode="preferred", + position="0x0", + scale=1 + }, -- desktop horizontal/left + { + output="HDMI-A-2", -- todo: description as ID + mode="1920x1080", + position="1920x-420", + scale=1, + transform=1 + }, -- desktop vertical/right + { + output="eDP-1", + mode="preferred", + position="0x0", + scale=1.25, + }, -- laptop main + { + output = "", + mode = "preferred", + position = "auto", + scale = 1 + } -- everything else +} + +-- # Catppuccin theme colors +palette = require "macchiato" + +-- Window rules +hl.window_rule({ + name = "launcher", + center = true, + stay_focused = true, + match = {class = "^(Rofi)$"}, +}) + +hl.config({ + general = { + gaps_in = 2, + gaps_out = 4, + border_size = 2, + ["col.active_border"] = palette.blue, + ["col.inactive_border"] = palette.overlay0, + layout = dwindle, + }, + input = { + kb_layout = "hu", + kb_variant = "102_qwertz_dot_nodead", + kb_options = "grp:menu_toggle", + follow_mouse = true, + touchpad = { natural_scroll = false, }, + sensitivity = 0, -- -1.0 .. 1.0, 0 means no modification. + }, + decoration = { + rounding = 5, + blur = { + enabled = true, + size = 3, + passes = 1, + }, + shadow = { + enabled = false, + range = 4, + render_power = 3, + color = 'rgba('..palette.baseAlpha.."ee)", + }, + }, + xwayland = { force_zero_scaling = true, }, + misc = { + vrr = 1, -- VRR on for every program needing it + disable_splash_rendering = true, + disable_hyprland_logo = true, + --force_hypr_chan = true -- there is suddenly an anime girl on the background :D + }, + debug = { disable_logs = false } +}) + +hl.curve("myBezier", {type="bezier", points={{0.05, 0.9}, {0.1, 1.05}}}) +hl.curve("cubic", {type="bezier", points={{0.65, 0}, {0.35, 1}}}) +hl.animation({leaf="windows", enabled=true, speed=7, bezier="myBezier"}) +hl.animation({leaf="windowsOut", enabled=true, speed=7, bezier="default", style="popin 80%"}) +hl.animation({leaf="border", enabled=true, speed=10, bezier="default"}) +hl.animation({leaf="borderangle", enabled=true, speed=8, bezier="default"}) +hl.animation({leaf="fade", enabled=true, speed=7, bezier="default"}) +hl.animation({leaf="workspaces", enabled=true, speed=6, bezier="myBezier", style="slidevert"}) +hl.animation({leaf="specialWorkspace", enabled=true, speed=3, bezier="cubic", style="slide"}) + +hl.gesture({fingers=4, direction="vertical", action="workspace"}) -- TODO: invert +-- hl.gesture({fingers=4, direction="horizontal", action="special"}) -- TODO: toggle +hl.gesture({fingers=3, direction="down", action=function () hl.dsp.exec_cmd("~/.config/rofi/launchers/type-1/launcher.sh") end}) +hl.gesture({fingers=3, direction="up", action=function() hl.dsp.exec_cmd("rofi -theme ~/.config/rofi/launchers/type-1/style-5.rasi -show calc -modi calc -no-show-match -no-sort -no-persist-history -calc-command \"echo -n '{result}' | wl-copy\"") end}) +hl.gesture({fingers=2, direction="pinch", action="cursor_zoom"}) +-- TODO: two finger left-right for back-forward +hl.gesture({fingers=5, direction="pinchout", action=function() hl.dsp.exec_cmd("/usr/bin/hyprlock") end}) +hl.gesture({fingers=5, direction="pinchin", action=function() hl.dsp.window.close() end}) + +require "exec" +require "keybinds" diff --git a/hypr/keybinds.lua b/hypr/keybinds.lua new file mode 100644 index 0000000..777ba67 --- /dev/null +++ b/hypr/keybinds.lua @@ -0,0 +1,77 @@ +-- Keybinds configuration file + +-- local mainMod = "SUPER + " + +local execs = { + -- Applications + F = "uwsm app nautilus", + T = "uwsm app kitty", + W = "uwsm app io.gitlab.librewolf-community.desktop", + SPACE = "~/.config/rofi/launchers/type-1/launcher.sh", + -- Launcher + ["SHIFT + V"] = "cliphist list | rofi -theme ~/.config/rofi/launchers/type-1/style-5.rasi -dmenu | cliphist decode | wl-copy", + ["SHIFT + CTRL + V"] = "cliphist list | rofi -theme ~/.config/rofi/launchers/type-1/style-5.rasi -dmenu | cliphist delete", + minus = "rofi -theme ~/.config/rofi/launchers/type-1/style-5.rasi -show calc -modi calc -no-show-match -no-sort -no-persist-history -calc-command \"echo -n '{result}' | wl-copy\"", + -- System components + B = "pkill waybar || uwsm app waybar", + N = "swaync-client -t -sw", + ["CTRL + BACKSPACE"] = "/usr/bin/hyprlock", + -- Screenshot + ["SHIFT + S"] = "slurp | grim -g - - | wl-copy && wl-paste > $(xdg-user-dir PICTURES)/screenshots/$(date + '%Y-%m-%d-%H%M%S_grim.png')", + ["SHIFT + CTRL + S"] = "grim - | wl-copy && wl-paste > $(xdg-user-dir PICTURES)/screenshots/$(date + '%Y-%m-%d-%H%M%S_grim.png')", + ["CTRL + C"] = "hyprpicker | wl-copy", +} +for key, cmd in pairs(execs) do + hl.bind("SUPER + "..key, hl.dsp.exec_cmd(cmd)) +end + +-- Move focus with "SUPER + " + arrow keys +for key,dir in pairs({H="left", J="down", K="up", L="left"}) do + hl.bind("SUPER + "..key, hl.dsp.focus({direction=dir})) + hl.bind("SUPER + ".."SHIFT + "..key, hl.dsp.window.move({direction=dir})) -- will this move workspace up? + -- hl.bind("SUPER + ".."SHIFT + "..direction, hl.dsp.window.move(direction=direction)) +end + +-- for key,dir in pairs({H={x=-10, y=0}, J={x=0, y=-10}, K={x=0, y=10}, L={x=10, y=0}}) do +-- hl.bind("SUPER + ".."CTRL + SHIFT + "..key, hl.dsp.window.resize({direction=dir}), {locked=false, repeating=false, ignore_mods=false}) +-- end + +for ws = 1,9 do + hl.bind("SUPER + ".."CTRL + "..ws, hl.dsp.focus({workspace=ws}), {locked=false, repeating=false, ignore_mods=false}) + hl.bind("SUPER + ".."SHIFT + "..ws, hl.dsp.window.move({workspace=ws}), {locked=false, repeating=false, ignore_mods=false}) +end + +for key,direction in pairs({mouse_down="r+1", mouse_up="r-1", K="r-1", J='r+1', up="r-1", down="r+1", END="empty", HOME="1"}) do + hl.bind("SUPER + ".."CTRL + "..key, hl.dsp.focus({workspace=direction}), {locked=false, repeating=false, ignore_mods=false}) + hl.bind("SUPER + ".."SHIFT + "..key, hl.dsp.window.move({workspace=direction}), {locked=false, repeating=false, ignore_mods=false}) +end + +hl.bind("SUPER + ".."BACKSPACE", hl.dsp.window.close(), {locked=false, repeating=false, ignore_mods=false}) +hl.bind("SUPER + ".."CTRL + ALT + BACKSPACE", hl.dsp.exit(), {locked=false, repeating=false, ignore_mods=false}) -- uwsm stop? loginctl? +hl.bind("SUPER + ".."Y", hl.dsp.window.float("toggle"), {locked=false, repeating=false, ignore_mods=false}) +hl.bind("SUPER + ".."P", hl.dsp.window.pin("toggle"), {locked=false, repeating=false, ignore_mods=false}) +hl.bind("SUPER + ".."E", hl.dsp.window.fullscreen("fullscreen", "toggle"), {locked=false, repeating=false, ignore_mods=false}) + +hl.bind("SUPER + ".."TAB", hl.dsp.workspace.toggle_special(), {locked=false, repeating=false, ignore_mods=false}) +hl.bind("SUPER + ".."mouse:274", hl.dsp.workspace.toggle_special(), {locked=false, repeating=false, ignore_mods=false}) +-- hl.bind("SUPER + ".."SHIFT + TAB", hl.dsp.window.move({workspace=special}), {locked=false, repeating=false, ignore_mods=false}) +-- hl.bind("SUPER + ".."SHIFT + mouse:274", hl.dsp.window.move({workspace=special}), {locked=false, repeating=false, ignore_mods=false}) + +hl.bind("SUPER + ".."mouse:272", hl.dsp.window.drag(), {mouse=true, drag=true, locked=false, repeating=false, ignore_mods=false}) +hl.bind("SUPER + ".."SHIFT + mouse:272", hl.dsp.window.resize(), {mouse=true, drag=true, locked=false, repeating=false, ignore_mods=false}) +hl.bind("SUPER + ".."mouse:273", hl.dsp.window.resize(), {mouse=true, drag=true, locked=false, repeating=false, ignore_mods=false}) + +-- Media keybinds: repeating and allow when locked +local media_execs = { + XF86AudioRaiseVolume="wpclt set-volume @DEFAULT_AUDIO_SINK@ 5% + ", + XF86AudioLowerVolume="wpclt set-volume @DEFAULT_AUDIO_SINK@ 5%-", + XF86AudioMute="wpclt set-mute @DEFAULT_AUDIO_SINK@ toggle", + XF86MonBrightnessUp="brightnessctl set 1% + ", + XF86MonBrightnessDown="brightnessctl set 1%-", + XF86AudioPlay="playerctl play-pause", + XF86AudioNext="playerctl next", + XF86AudioPrev="playerctl previous", +} +for key,cmd in pairs(media_execs) do + hl.bind("SUPER + "..key, hl.dsp.exec_cmd(cmd), {locked=true, repeating=true, ignore_mods=true}) +end diff --git a/hypr/macchiato.lua b/hypr/macchiato.lua new file mode 100644 index 0000000..9e03824 --- /dev/null +++ b/hypr/macchiato.lua @@ -0,0 +1,81 @@ +local M = {} + +M.rosewater = 'rgb(f4dbd6)' +M.rosewaterAlpha = 'f4dbd6' + +M.flamingo = 'rgb(f0c6c6)' +M.flamingoAlpha = 'f0c6c6' + +M.pink = 'rgb(f5bde6)' +M.pinkAlpha = 'f5bde6' + +M.mauve = 'rgb(c6a0f6)' +M.mauveAlpha = 'c6a0f6' + +M.red = 'rgb(ed8796)' +M.redAlpha = 'ed8796' + +M.maroon = 'rgb(ee99a0)' +M.maroonAlpha = 'ee99a0' + +M.peach = 'rgb(f5a97f)' +M.peachAlpha = 'f5a97f' + +M.yellow = 'rgb(eed49f)' +M.yellowAlpha = 'eed49f' + +M.green = 'rgb(a6da95)' +M.greenAlpha = 'a6da95' + +M.teal = 'rgb(8bd5ca)' +M.tealAlpha = '8bd5ca' + +M.sky = 'rgb(91d7e3)' +M.skyAlpha = '91d7e3' + +M.sapphire = 'rgb(7dc4e4)' +M.sapphireAlpha = '7dc4e4' + +M.blue = 'rgb(8aadf4)' +M.blueAlpha = '8aadf4' + +M.lavender = 'rgb(b7bdf8)' +M.lavenderAlpha = 'b7bdf8' + +M.text = 'rgb(cad3f5)' +M.textAlpha = 'cad3f5' + +M.subtext1 = 'rgb(b8c0e0)' +M.subtext1Alpha = 'b8c0e0' + +M.subtext0 = 'rgb(a5adcb)' +M.subtext0Alpha = 'a5adcb' + +M.overlay2 = 'rgb(939ab7)' +M.overlay2Alpha = '939ab7' + +M.overlay1 = 'rgb(8087a2)' +M.overlay1Alpha = '8087a2' + +M.overlay0 = 'rgb(6e738d)' +M.overlay0Alpha = '6e738d' + +M.surface2 = 'rgb(5b6078)' +M.surface2Alpha = '5b6078' + +M.surface1 = 'rgb(494d64)' +M.surface1Alpha = '494d64' + +M.surface0 = 'rgb(363a4f)' +M.surface0Alpha = '363a4f' + +M.base = 'rgb(24273a)' +M.baseAlpha = '24273a' + +M.mantle = 'rgb(1e2030)' +M.mantleAlpha = '1e2030' + +M.crust = 'rgb(181926)' +M.crustAlpha = '181926' + +return M