Files
ricing/hypr/hyprland.lua

651 lines
17 KiB
Lua
Raw Normal View History

-- 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,
})
-- Cursor (and thus initial focus/workspace) should start on the primary monitor
hl.config({
cursor = {
default_monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001",
},
})
-- ----------------------------------------------------------
-- Environment
-- ----------------------------------------------------------
hl.env("XCURSOR_SIZE", 24)
hl.env("HYPRCURSOR_SIZE", 24)
-- Arch-logo pointer, built by hypr/cursor/build.py into ~/.local/share/icons/ArchLogo
hl.env("XCURSOR_THEME", "ArchLogo")
hl.env("HYPRCURSOR_THEME", "ArchLogo")
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 = "thunar"
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,
accel_profile = "flat",
touchpad = {
clickfinger_behavior = true,
scroll_factor = 0.4,
},
},
})
-- ----------------------------------------------------------
-- Look and Feel
-- ----------------------------------------------------------
-- Border-Farben aus theme/colors.toml (wird bei jedem Theme-Wechsel neu generiert, siehe theme/render.py)
-- Liest die 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_theme_conf()
local path = (os.getenv("HOME") or "") .. "/.config/hypr/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 theme = read_theme_conf()
hl.config({
general = {
gaps_in = 5,
gaps_out = 10,
border_size = 2,
resize_on_border = true,
allow_tearing = false,
layout = "dwindle",
col = theme and {
active_border = { colors = { theme.active1, theme.active2 }, angle = 45 },
inactive_border = theme.inactive,
} or nil,
},
})
if theme then
hl.config({
group = {
col = {
border_active = { colors = { theme.active1, theme.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("thunar"))
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"))
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "H", hl.dsp.exec_cmd("quickshell -c default ipc call help toggle"))
-- ----------------------------------------------------------
-- Keybinds: Window control
-- ----------------------------------------------------------
hl.bind(mainMod .. " + " .. "Q", hl.dsp.window.close())
hl.bind(mainMod .. " + " .. "SHIFT" .. " + " .. "E", hl.dsp.exit())
-- pgrep guard: pressing the bind again (or anything re-triggering it) while hyprlock is
-- already running must not spawn a second instance on top of the first.
hl.bind(mainMod .. " + " .. "L", hl.dsp.exec_cmd("pgrep -x hyprlock || hyprlock"))
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 -theme ~/.config/rofi/arch-blue.rasi | 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,
})
-- Workaround: every new kitty window has been coming up in real Hyprland
-- fullscreen (hasfullscreen=true, needs fullscreen() dispatched twice to
-- clear) regardless of workspace - root cause not found. "fullscreen = false"
-- is a no-op (that's just the default, it doesn't force anything); this
-- overrides both the internal and client-requested fullscreen state instead.
hl.window_rule({
name = "no_fullscreen_kitty",
match = {
class = "^(kitty)$",
},
fullscreen_state = "0 0",
})
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("mako")
hl.exec_cmd("nm-applet --indicator")
Move mouse widget standalone, add RGB control widget, align peripherals The mouse battery pill lived in Bar.qml, duplicated per-screen (it renders once per monitor) and invisible whenever taskbar mode hid the stats row entirely. Pulled into its own MouseWidget.qml, same standalone pattern as the theme widget - single instance, click opens DPI/poll-rate/idle-time/low-battery-threshold controls. mouse_battery.py folded into the new mouse.py (adds set-dpi-stage/set-poll-rate/ set-idle-time/set-low-battery-threshold on top of the old status-only script). New RGBWidget.qml + scripts/rgb.py: per-device mode/color/speed/ brightness for RAM/GPU/mainboard RGB via OpenRGB's SDK server (autostarted headless in hyprland.lua), plus a one-click "sync all to accent". Both RAM sticks are grouped into one card/one set of controls since they're the same model - rgb.py's commands take a comma-separated device-id list for exactly this. Found and worked around two real issues along the way: this server build mishandles openrgb-python's default protocol version (pinned to 3 instead), and set_color() doesn't reliably force Direct mode first on its own - a device left on a cycling effect can keep animating right through a color-set call despite it reporting success, worst on the GPU's own i2c adapter. Mitigated with an explicit mode switch + verify-and-retry. Also: hyprland.lua was missing accel_profile entirely, so libinput's default adaptive curve was always active - flat now, for the 1:1 response a gaming mouse is normally run with (found while chasing an unrelated OpenRazer DPI reset making it suddenly noticeable). Widget layout: all three corner widgets now align on a shared row height instead of each guessing the previous one's width. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
2026-10-04 02:12:09 +02:00
-- --server alone: headless SDK server, no GUI/tray window. Keeps RAM/GPU/mainboard
-- RGB devices detected in memory so RGBWidget's queries are fast - the plain CLI
-- re-detects all hardware (~5s) on every single invocation.
hl.exec_cmd("openrgb --server")
hl.exec_cmd("python3 ~/.config/theme/wallpaper.py start")
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\"")
hl.exec_cmd("gsettings set org.gnome.desktop.interface cursor-theme \"ArchLogo\"")
hl.exec_cmd("gsettings set org.gnome.desktop.interface cursor-size 24")
hl.exec_cmd("gsettings set org.gnome.desktop.interface icon-theme \"AetherRice\"")
end)
-- deadlocked_overlay no_blur windowrule
hl.window_rule({
match = {
title = "^(deadlocked_overlay)$",
},
no_blur = true,
monitor = "desc:HKC OVERSEAS LIMITED 27E6QC 0000000000001",
})