From 14c34bf38810e3903303aa0d4cfdac6f7c4c09ea Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 10 Sep 2026 16:37:20 +0200 Subject: [PATCH] Add Lua Hyprland config and fix Quickshell bar for the Lua dispatch protocol hyprland.lua is the new active config (auto-generated from hyprland.conf via hyprconf2lua, then finished by hand): - Fixed monitorv2 sections to use hl.monitor() instead of hl.config({monitorv2=...}), which isn't a valid section key - Restored the double space in the LG monitor's description string, which had been silently normalized by the converter and broke workspace-rule monitor matching (workspaces 5-8 were binding to the wrong display) - Finished the aether border-color TODO: reads aether-theme.conf at config-load time and applies general.col.active_border/inactive_border + group.col.border_active, preserving the dynamic behavior from the old `source = aether-theme.conf` line Bar.qml: the Lua config changed Hyprland's dispatch IPC syntax from plain strings ("workspace 5") to Lua expressions (hl.dsp.focus({workspace = 5})), which broke workspace-switch clicks and the window-switcher focus clicks. Updated both call sites to the new syntax, and fixed the active-workspace highlight to only show on the focused monitor (Hyprland's own "active" flag is per-monitor, not global). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94 --- hypr/hyprland.lua | 601 +++++++++++++++++++++++++++++++++++++ quickshell/default/Bar.qml | 6 +- 2 files changed, 604 insertions(+), 3 deletions(-) create mode 100644 hypr/hyprland.lua diff --git a/hypr/hyprland.lua b/hypr/hyprland.lua new file mode 100644 index 0000000..ddf23f0 --- /dev/null +++ b/hypr/hyprland.lua @@ -0,0 +1,601 @@ +-- Generated by hyprconf2lua v1.8.1 +-- https://github.com/Prateek-squadron/hyprconf2lua +-- Manual review may be needed for complex directives + +---@module 'hl' + +-- ========================================================== + +-- Custom Arch / Hyprland Config + +-- Style: Arch + Productivity + Anime/Gaming balance + +-- Target: Hyprland 0.55.2+ + +-- Caps Lock normal, no Omarchy source structure + +-- ========================================================== + +-- ---------------------------------------------------------- + +-- Monitors + +-- ---------------------------------------------------------- + +hl.monitor({ + output = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001", + mode = "2560x1440@144.00", + position = "0x0", + scale = 1, + sdr_min_luminance = 0.2, + sdr_max_luminance = 80, +}) + +hl.monitor({ + output = "desc:LG Electronics L226W 0x00013D4D", + mode = "1680x1050@59.88", + position = "2560x0", + scale = 1, + sdr_min_luminance = 0.2, + sdr_max_luminance = 80, +}) + +-- ---------------------------------------------------------- + +-- Environment + +-- ---------------------------------------------------------- + +hl.env("XCURSOR_SIZE", 24) + +hl.env("HYPRCURSOR_SIZE", 24) + +hl.env("QT_QPA_PLATFORM", "wayland;xcb") + +hl.env("GDK_BACKEND", "wayland,x11") + +hl.env("SDL_VIDEODRIVER", "wayland") + +hl.env("CLUTTER_BACKEND", "wayland") + +-- NVIDIA + +hl.env("NVD_BACKEND", "direct") + +hl.env("LIBVA_DRIVER_NAME", "nvidia") + +hl.env("__GLX_VENDOR_LIBRARY_NAME", "nvidia") + +-- ---------------------------------------------------------- + +-- Apps + +-- ---------------------------------------------------------- + +local terminal = "kitty" + +local fileManager = "dolphin" + +local menu = "rofi -show drun -theme ~/.config/rofi/arch-blue.rasi" + +local browser = "zen-browser" + +local mainMod = "SUPER" + +-- ---------------------------------------------------------- + +-- Autostart + +-- ---------------------------------------------------------- + + + + + + + +-- ---------------------------------------------------------- + +-- Input + +-- ---------------------------------------------------------- + +hl.config({ + input = { + kb_layout = "de", + repeat_rate = 40, + repeat_delay = 250, + numlock_by_default = true, + follow_mouse = 1, + sensitivity = 0, + touchpad = { + clickfinger_behavior = true, + scroll_factor = 0.4, + }, + }, +}) + +-- ---------------------------------------------------------- + +-- Look and Feel + +-- ---------------------------------------------------------- + +-- Border-Farben von aether (wird bei jedem Theme-Wechsel neu generiert) +-- Liest die von aether generierte Datei direkt bei jedem Config-Reload, +-- damit ein Theme-Wechsel (der die Datei neu schreibt + reload triggert) +-- weiterhin automatisch die Rahmenfarben aktualisiert. +local function read_aether_theme() + local path = (os.getenv("HOME") or "") .. "/.config/hypr/aether-theme.conf" + local f = io.open(path, "r") + if not f then return nil end + local content = f:read("*a") + f:close() + + local active1 = content:match("%$activeBorderColor1%s*=%s*(%S+)") + local active2 = content:match("%$activeBorderColor2%s*=%s*(%S+)") + local inactive = content:match("%$inactiveBorderColor%s*=%s*(%S+)") + if not (active1 and active2 and inactive) then return nil end + + return { active1 = active1, active2 = active2, inactive = inactive } +end + +local aether = read_aether_theme() + +hl.config({ + general = { + gaps_in = 5, + gaps_out = 10, + border_size = 2, + resize_on_border = true, + allow_tearing = false, + layout = "dwindle", + col = aether and { + active_border = { colors = { aether.active1, aether.active2 }, angle = 45 }, + inactive_border = aether.inactive, + } or nil, + }, +}) + +if aether then + hl.config({ + group = { + col = { + border_active = { colors = { aether.active1, aether.active2 }, angle = 45 }, + }, + }, + }) +end + +hl.config({ + decoration = { + rounding = 8, + active_opacity = 1, + inactive_opacity = 1, + shadow = { + enabled = true, + render_power = 3, + range = 16, + color = "rgba(00000052)", + }, + blur = { + enabled = true, + size = 10, + passes = 2, + vibrancy = 0.15, + }, + }, +}) + +hl.config({ + animations = { + enabled = true, + }, +}) +hl.curve("clean", { + type = "bezier", + points = { { 0.05, 0.9 }, { 0.1, 1.0 } }, +}) +hl.curve("fast", { + type = "bezier", + points = { { 0.15, 1.0 }, { 0.3, 1.0 } }, +}) +hl.animation({ leaf = "windows", enabled = true, speed = 5, bezier = "clean" }) +hl.animation({ leaf = "windowsOut", enabled = true, speed = 4, bezier = "fast", style = "popin 80%" }) +hl.animation({ leaf = "border", enabled = true, speed = 5, bezier = "clean" }) +hl.animation({ leaf = "fade", enabled = true, speed = 4, bezier = "clean" }) +hl.animation({ leaf = "workspaces", enabled = true, speed = 5, bezier = "clean" }) + +hl.config({ + dwindle = { + preserve_split = true, + smart_split = false, + }, +}) + +hl.config({ + master = { + new_status = "master", + }, +}) + +hl.config({ + misc = { + disable_hyprland_logo = true, + disable_splash_rendering = true, + force_default_wallpaper = 1, + }, +}) + + +-- for GTK3 apps + + +-- for GTK4 apps + +hl.env("QT_QPA_PLATFORMTHEME", "qt6ct") + +-- for Qt apps + +-- ---------------------------------------------------------- + +-- Workspaces + +-- ---------------------------------------------------------- + +hl.workspace_rule({ + workspace = 1, + monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001", + default = true, + persistent = true, +}) + +hl.workspace_rule({ + workspace = 2, + monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001", +}) + +hl.workspace_rule({ + workspace = 3, + monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001", +}) + +hl.workspace_rule({ + workspace = 4, + monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001", +}) + +hl.workspace_rule({ + workspace = 5, + monitor = "desc:LG Electronics L226W 0x00013D4D", + default = true, + persistent = true, +}) + +hl.workspace_rule({ + workspace = 6, + monitor = "desc:LG Electronics L226W 0x00013D4D", +}) + +hl.workspace_rule({ + workspace = 7, + monitor = "desc:LG Electronics L226W 0x00013D4D", +}) + +hl.workspace_rule({ + workspace = 8, + monitor = "desc:LG Electronics L226W 0x00013D4D", +}) + +hl.workspace_rule({ + workspace = 9, + monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001", +}) + +-- ---------------------------------------------------------- + +-- Keybinds: Apps + +-- ---------------------------------------------------------- + +hl.bind(mainMod .. " + " .. "RETURN", hl.dsp.exec_cmd("kitty")) + +hl.bind(mainMod .. " + " .. "W", hl.dsp.exec_cmd("zen-browser")) + +hl.bind(mainMod .. " + " .. "N", hl.dsp.exec_cmd("dolphin")) + +hl.bind(mainMod .. " + " .. "SPACE", hl.dsp.exec_cmd("rofi -show drun -theme ~/.config/rofi/arch-blue.rasi")) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "P", hl.dsp.exec_cmd("spotify")) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "C", hl.dsp.exec_cmd("discord")) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "S", hl.dsp.exec_cmd("steam")) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "T", hl.dsp.exec_cmd("kitty -e btop")) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "A", hl.dsp.exec_cmd("quickshell -c default ipc call windowswitcher toggle")) + +-- ---------------------------------------------------------- + +-- Keybinds: Window control + +-- ---------------------------------------------------------- + +hl.bind(mainMod .. " + " .. "Q", hl.dsp.window.close()) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "E", hl.dsp.exit()) + +hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen()) + +hl.bind(mainMod .. " + " .. "V", hl.dsp.window.float()) + +hl.bind(mainMod .. " + " .. "P", hl.dsp.window.pseudo()) + +hl.bind(mainMod .. " + " .. "left", hl.dsp.focus({ direction = "left" })) + +hl.bind(mainMod .. " + " .. "right", hl.dsp.focus({ direction = "right" })) + +hl.bind(mainMod .. " + " .. "K", hl.dsp.focus({ direction = "up" })) + +hl.bind(mainMod .. " + " .. "J", hl.dsp.focus({ direction = "down" })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "left", hl.dsp.window.move({ direction = "left" })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "right", hl.dsp.window.move({ direction = "right" })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "up", hl.dsp.window.move({ direction = "up" })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "down", hl.dsp.window.move({ direction = "down" })) + +hl.bind(mainMod .. " + " .. "CTRL" .. " + " .. "H", hl.dsp.window.resize({ x = -30, y = 0, relative = true }), { repeating = true }) + +hl.bind(mainMod .. " + " .. "CTRL" .. " + " .. "L", hl.dsp.window.resize({ x = 30, y = 0, relative = true }), { repeating = true }) + +hl.bind(mainMod .. " + " .. "CTRL" .. " + " .. "K", hl.dsp.window.resize({ x = 0, y = -30, relative = true }), { repeating = true }) + +hl.bind(mainMod .. " + " .. "CTRL" .. " + " .. "J", hl.dsp.window.resize({ x = 0, y = 30, relative = true }), { repeating = true }) + +-- ---------------------------------------------------------- + +-- Workspace binds + +-- ---------------------------------------------------------- + +hl.bind(mainMod .. " + " .. 1, hl.dsp.focus({ workspace = 1 })) + +hl.bind(mainMod .. " + " .. 2, hl.dsp.focus({ workspace = 2 })) + +hl.bind(mainMod .. " + " .. 3, hl.dsp.focus({ workspace = 3 })) + +hl.bind(mainMod .. " + " .. 4, hl.dsp.focus({ workspace = 4 })) + +hl.bind(mainMod .. " + " .. 5, hl.dsp.focus({ workspace = 5 })) + +hl.bind(mainMod .. " + " .. 6, hl.dsp.focus({ workspace = 6 })) + +hl.bind(mainMod .. " + " .. 7, hl.dsp.focus({ workspace = 7 })) + +hl.bind(mainMod .. " + " .. 8, hl.dsp.focus({ workspace = 8 })) + +hl.bind(mainMod .. " + " .. 9, hl.dsp.focus({ workspace = 9 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 1, hl.dsp.window.move({ workspace = 1 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 2, hl.dsp.window.move({ workspace = 2 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 3, hl.dsp.window.move({ workspace = 3 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 4, hl.dsp.window.move({ workspace = 4 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 5, hl.dsp.window.move({ workspace = 5 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 6, hl.dsp.window.move({ workspace = 6 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 7, hl.dsp.window.move({ workspace = 7 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 8, hl.dsp.window.move({ workspace = 8 })) + +hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. 9, hl.dsp.window.move({ workspace = 9 })) + +hl.bind(mainMod .. " + " .. "mouse_down", hl.dsp.focus({ workspace = "e+1" })) + +hl.bind(mainMod .. " + " .. "mouse_up", hl.dsp.focus({ workspace = "e-1" })) + +-- ---------------------------------------------------------- + +-- Mouse binds + +-- ---------------------------------------------------------- + +hl.bind(mainMod .. " + " .. "mouse:272", hl.dsp.window.drag(), { mouse = true }) + +hl.bind(mainMod .. " + " .. "mouse:273", hl.dsp.window.resize(), { mouse = true }) + +-- ---------------------------------------------------------- + +-- Screenshots / clipboard + +-- ---------------------------------------------------------- + +hl.bind("PRINT", hl.dsp.exec_cmd("grim -g \"$(slurp)\" - | wl-copy")) + +hl.bind("SHIFT + PRINT", hl.dsp.exec_cmd("mkdir -p ~/Pictures/Screenshots && grim -g \"$(slurp)\" ~/Pictures/Screenshots/screenshot-$(date +%Y-%m-%d_%H-%M-%S).png")) + +hl.bind(mainMod .. " + " .. "C", hl.dsp.exec_cmd("cliphist list | rofi -dmenu | cliphist decode | wl-copy")) + +-- ---------------------------------------------------------- + +-- Audio / brightness / media + +-- ---------------------------------------------------------- + +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), { repeating = true, locked = true }) + +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), { repeating = true, locked = true }) + +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true }) + +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true }) + +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set 5%+"), { repeating = true, locked = true }) + +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 5%-"), { repeating = true, locked = true }) + +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) + +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) + +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) + +-- ---------------------------------------------------------- + +-- Window rules - new Hyprland 0.55 syntax + +-- ---------------------------------------------------------- + +-- Terminal touchpad scroll + +hl.window_rule({ + name = "scroll_touchpad_1_5_275", + match = { + class = "^(Alacritty|kitty|foot)$", + }, + scroll_touchpad = 1.5, +}) + +hl.window_rule({ + name = "scroll_touchpad_0_2_276", + match = { + class = "^(com.mitchellh.ghostty)$", + }, + scroll_touchpad = 0.2, +}) + +-- Gaming / anime / media + +hl.window_rule({ + name = "workspace_7_279", + match = { + class = "^(steam)$", + }, + workspace = 7, +}) + +hl.window_rule({ + name = "workspace_5_280", + match = { + class = "^(discord)$", + }, + workspace = 5, +}) + +hl.window_rule({ + name = "workspace_5_281", + match = { + class = "^(vesktop)$", + }, + workspace = 5, +}) + +hl.window_rule({ + name = "workspace_6_282", + match = { + class = "^(Spotify)$", + }, + workspace = 6, +}) + +hl.window_rule({ + name = "workspace_6_283", + match = { + title = "^(.*YouTube.*)$", + }, + workspace = 6, +}) + +hl.window_rule({ + name = "workspace_1_284", + match = { + title = "^(zen*)$", + }, + workspace = 1, +}) + +-- Floating helpers + +hl.window_rule({ + name = "float_on_287", + match = { + class = "^(pavucontrol)$", + }, + float = true, + size = { 900, 600 }, + center = true, +}) + +hl.window_rule({ + name = "float_on_288", + match = { + class = "^(blueman-manager)$", + }, + float = true, + center = true, +}) + +hl.window_rule({ + name = "float_on_289", + match = { + class = "^(nm-connection-editor)$", + }, + float = true, + center = true, +}) + +-- Games + +hl.window_rule({ + name = "fullscreen_on_292", + match = { + class = "^(steam_app_.*)$", + }, + fullscreen = true, +}) + +-- Dialogs + +hl.window_rule({ + name = "float_on_295", + match = { + title = "^(Open File)$", + }, + float = true, + center = true, +}) + +hl.window_rule({ + name = "float_on_296", + match = { + title = "^(Save File)$", + }, + float = true, + center = true, +}) + +hl.bind(mainMod .. " + " .. "ALT" .. " + " .. "C", hl.dsp.exec_cmd("env GTK_THEME=Adwaita XDG_CONFIG_HOME=~/.config qalculate-gtk")) + +-- Autostart +hl.on("hyprland.start", function() + hl.exec_cmd("quickshell -c default") + hl.exec_cmd("dunst") + hl.exec_cmd("nm-applet --indicator") + hl.exec_cmd("swaybg -i ~/.config/hypr/wallpaper.png -m fill") + hl.exec_cmd("wl-paste --type text --watch cliphist store") + hl.exec_cmd("wl-paste --type image --watch cliphist store") +end) + +-- Exec (run every reload) +hl.on("config.reloaded", function() + hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme \"Materia-dark\"") + hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme \"prefer-dark\"") +end) diff --git a/quickshell/default/Bar.qml b/quickshell/default/Bar.qml index a966242..cb837cd 100644 --- a/quickshell/default/Bar.qml +++ b/quickshell/default/Bar.qml @@ -290,7 +290,7 @@ Variants { } return null } - readonly property bool active: hyprWs !== null && hyprWs.active + readonly property bool active: hyprWs !== null && hyprWs.active && Hyprland.focusedMonitor !== null && Hyprland.focusedMonitor.name === bar.modelData.name Layout.preferredWidth: 22 Layout.preferredHeight: 20 @@ -316,7 +316,7 @@ Variants { id: wsArea anchors.fill: parent hoverEnabled: true - onClicked: Hyprland.dispatch("workspace " + wsBtn.modelData) + onClicked: Hyprland.dispatch("hl.dsp.focus({workspace = " + wsBtn.modelData + "})") } } } @@ -1213,7 +1213,7 @@ Variants { onClicked: { var addr = winRow.modelData.address if (!addr.startsWith("0x")) addr = "0x" + addr - Hyprland.dispatch("focuswindow address:" + addr) + Hyprland.dispatch("hl.dsp.focus({window = \"address:" + addr + "\"})") root.windowSwitcherOpen = false } }