From d6561d9d20263fcf64d99d60cfba4a806ba9d038 Mon Sep 17 00:00:00 2001 From: John Costa Date: Mon, 1 Jun 2026 16:38:00 +0100 Subject: [PATCH] feat: Migrating hyprland to lua --- .../hypr/{hyprland.conf => hyprland.conf.bak} | 2 +- config/hypr/hyprland.lua | 286 ++++++++++++++++++ config/hypr/themes/mocha.conf | 77 ----- 3 files changed, 287 insertions(+), 78 deletions(-) rename config/hypr/{hyprland.conf => hyprland.conf.bak} (99%) create mode 100644 config/hypr/hyprland.lua delete mode 100644 config/hypr/themes/mocha.conf diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf.bak similarity index 99% rename from config/hypr/hyprland.conf rename to config/hypr/hyprland.conf.bak index 999c4377..6396beb1 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf.bak @@ -23,7 +23,7 @@ source=~/.config/hypr/themes/mocha.conf ################ # See https://wiki.hyprland.org/Configuring/Monitors/ -#DESKTOP: monitor=HDMI-A-1,2560x1440@144,1920x0,1,mirror,EDP-1 +monitor=HDMI-A-1,2560x1440@144,1920x0,1,mirror,EDP-1 #LAPTOP: monitor=,preferred,auto,1 diff --git a/config/hypr/hyprland.lua b/config/hypr/hyprland.lua new file mode 100644 index 00000000..7f675253 --- /dev/null +++ b/config/hypr/hyprland.lua @@ -0,0 +1,286 @@ +-- Hyprland Lua Configuration +-- Migrated from hyprlang for Hyprland 0.55+ + +-------------------- +--- MONITORS --- +-------------------- + +-- See https://wiki.hypr.land/Configuring/Basics/Monitors/ +-- Use empty output as catch-all since connector reports as Unknown-1 +hl.monitor({ + output = "", + mode = "2560x1440@144", + position = "0x0", + scale = 1, +}) + +-------------------- +--- MY PROGRAMS --- +-------------------- + +local terminal = "kitty" +local fileManager = "dolphin" +local menu = "wofi --show drun" + +-------------------- +--- AUTOSTART --- +-------------------- + +-- See https://wiki.hypr.land/Configuring/Basics/Autostart/ +hl.on("hyprland.start", function() + hl.exec_cmd("waybar") + hl.exec_cmd("wl-paste --watch cliphist store") + hl.exec_cmd("hyprpaper") + hl.exec_cmd("kdeconnectd") + hl.exec_cmd("dunst") + hl.exec_cmd("XDG_MENU_PREFIX=arch- kbuildsycoca6") +end) + +-------------------- +--- ENVIRONMENT VARIABLES --- +-------------------- + +-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Environment-variables/ +hl.env("XCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_SIZE", "24") +-- Removed: __NV_DISABLE_EXPLICIT_SYNC was a workaround for old NVIDIA drivers +-- that now causes lag in Hyprland 0.55+. Re-enable only if you get crashes. +-- hl.env("__NV_DISABLE_EXPLICIT_SYNC", "1") +hl.env("QT_QPA_PLATFORMTHEME", "qt6ct") +hl.env("QT_QPA_PLATFORM", "wayland") +hl.env("QT_QPA_PLATFORMTHEME", "qt5ct") + +-- GTK theming +hl.exec_cmd('gsettings set org.gnome.desktop.interface gtk-theme "catppuccin-mocha-blue-standard+default"') +hl.exec_cmd('gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"') + +-------------------- +--- LOOK AND FEEL --- +-------------------- + +-- Refer to https://wiki.hypr.land/Configuring/Basics/Variables/ +hl.config({ + general = { + gaps_in = 4, + gaps_out = 10, + border_size = 2, + + col = { + active_border = { colors = { "rgba(33ccffee)", "rgba(00ff99ee)" }, angle = 45 }, + inactive_border = "rgba(595959aa)", + }, + + resize_on_border = false, + allow_tearing = false, + layout = "dwindle", + }, + + decoration = { + rounding = 20, + rounding_power = 2, + + active_opacity = 1.0, + inactive_opacity = 1.0, + + shadow = { + enabled = true, + range = 4, + render_power = 3, + color = 0xee1a1a1a, + }, + + blur = { + enabled = true, + size = 3, + passes = 1, + vibrancy = 0.1696, + }, + }, + + animations = { + enabled = true, + }, +}) + +-- Curves / beziers +-- See 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 } } }) +hl.curve("quick", { type = "bezier", points = { { 0.15, 0 }, { 0.1, 1 } } }) + +-- Animations +hl.animation({ leaf = "global", enabled = true, speed = 10, bezier = "default" }) +hl.animation({ leaf = "border", enabled = true, speed = 5.39, bezier = "easeOutQuint" }) +hl.animation({ leaf = "windows", enabled = true, speed = 4.79, bezier = "easeOutQuint" }) +hl.animation({ leaf = "windowsIn", enabled = true, speed = 4.1, bezier = "easeOutQuint", style = "popin 87%" }) +hl.animation({ leaf = "windowsOut", enabled = true, speed = 1.49, bezier = "linear", style = "popin 87%" }) +hl.animation({ leaf = "fadeIn", enabled = true, speed = 1.73, bezier = "almostLinear" }) +hl.animation({ leaf = "fadeOut", enabled = true, speed = 1.46, bezier = "almostLinear" }) +hl.animation({ leaf = "fade", enabled = true, speed = 3.03, bezier = "quick" }) +hl.animation({ leaf = "layers", enabled = true, speed = 3.81, bezier = "easeOutQuint" }) +hl.animation({ leaf = "layersIn", enabled = true, speed = 4, bezier = "easeOutQuint", style = "fade" }) +hl.animation({ leaf = "layersOut", enabled = true, speed = 1.5, bezier = "linear", style = "fade" }) +hl.animation({ leaf = "fadeLayersIn", enabled = true, speed = 1.79, bezier = "almostLinear" }) +hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = 1.39, bezier = "almostLinear" }) +hl.animation({ leaf = "workspaces", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" }) +hl.animation({ leaf = "workspacesIn", enabled = true, speed = 1.21, bezier = "almostLinear", style = "fade" }) +hl.animation({ leaf = "workspacesOut", enabled = true, speed = 1.94, bezier = "almostLinear", style = "fade" }) + +-------------------- +--- LAYOUTS --- +-------------------- + +-- See https://wiki.hypr.land/Configuring/Layouts/Dwindle-Layout/ +hl.config({ + dwindle = { + preserve_split = true, + }, +}) + +-- See https://wiki.hypr.land/Configuring/Layouts/Master-Layout/ +hl.config({ + master = { + new_status = "master", + }, +}) + +-------------------- +--- MISC --- +-------------------- + +hl.config({ + misc = { + force_default_wallpaper = -1, + disable_hyprland_logo = false, + }, +}) + +-------------------- +--- INPUT --- +-------------------- + +hl.config({ + input = { + kb_layout = "us", + kb_variant = "", + kb_model = "", + kb_options = "", + kb_rules = "", + + follow_mouse = 1, + sensitivity = -2, + + touchpad = { + natural_scroll = false, + }, + + repeat_delay = 200, + repeat_rate = 50, + }, +}) + +-- Per-device config +-- See https://wiki.hypr.land/Configuring/Advanced-and-Cool/Devices/ +hl.device({ + name = "epic-mouse-v1", + sensitivity = -0.5, +}) + +-------------------- +--- KEYBINDINGS --- +-------------------- + +local mainMod = "SUPER" + +-- Screenshots & Clipboard +hl.bind(mainMod .. " + SHIFT + S", hl.dsp.exec_cmd("hyprshot -m region -o ~/Pictures/Screenshots")) +hl.bind(mainMod .. " + V", hl.dsp.exec_cmd("cliphist list | fuzzel --dmenu | cliphist decode | wl-copy")) + +-- Audio control +hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle")) +hl.bind(mainMod .. " + K", hl.dsp.exec_cmd("bash ~/Code/dotfiles/scripts/toggle-speakers.bash")) + +-- Toggle waybar +hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("bash ~/Code/dotfiles/scripts/toggle-waybar.bash")) + +-- Core binds +hl.bind(mainMod .. " + T", hl.dsp.exec_cmd(terminal)) +hl.bind(mainMod .. " + Q", hl.dsp.window.close()) +hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager)) +hl.bind(mainMod .. " + SHIFT + V", hl.dsp.window.float({ action = "toggle" })) +hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit")) +hl.bind(mainMod .. " + Slash", hl.dsp.exec_cmd("fuzzel")) + +-- Move focus with mainMod + arrow keys +hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" })) +hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" })) +hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" })) +hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" })) + +-- Switch workspaces with mainMod + [0-9] +-- Move active window to a workspace with mainMod + SHIFT + [0-9] +for i = 1, 10 do + local key = i % 10 + hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i })) + hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i })) +end + +-- Workspace navigation +hl.bind(mainMod .. " + Tab", hl.dsp.exec_cmd("hyprctl dispatch workspace previous")) + +-- Scroll through existing workspaces with mainMod + scroll +hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" })) +hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" })) + +-- OBS +hl.bind(mainMod .. " + R", hl.dsp.exec_cmd("obs-cmd recording toggle")) + +-- Move/resize windows with mainMod + LMB/RMB and dragging +hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) + +-- Laptop multimedia keys for volume and LCD brightness +hl.bind( + "XF86AudioRaiseVolume", + hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"), + { locked = true, repeating = true } +) +hl.bind( + "XF86AudioLowerVolume", + hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), + { locked = true, repeating = true } +) +hl.bind( + "XF86AudioMute", + hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), + { 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 10%+"), { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl s 10%-"), { 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 }) + +-- Lid switch +hl.bind("switch:Lid Switch", hl.dsp.exec_cmd("hyprlock"), { locked = true }) + +-------------------- +--- WINDOWS AND WORKSPACES --- +-------------------- + +-- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/ +hl.window_rule({ + name = "suppress-maximize-events", + match = { class = ".*" }, + suppress_event = "maximize", +}) diff --git a/config/hypr/themes/mocha.conf b/config/hypr/themes/mocha.conf deleted file mode 100644 index 2b80922d..00000000 --- a/config/hypr/themes/mocha.conf +++ /dev/null @@ -1,77 +0,0 @@ -$rosewater = rgb(f5e0dc) -$rosewaterAlpha = f5e0dc - -$flamingo = rgb(f2cdcd) -$flamingoAlpha = f2cdcd - -$pink = rgb(f5c2e7) -$pinkAlpha = f5c2e7 - -$mauve = rgb(cba6f7) -$mauveAlpha = cba6f7 - -$red = rgb(f38ba8) -$redAlpha = f38ba8 - -$maroon = rgb(eba0ac) -$maroonAlpha = eba0ac - -$peach = rgb(fab387) -$peachAlpha = fab387 - -$yellow = rgb(f9e2af) -$yellowAlpha = f9e2af - -$green = rgb(a6e3a1) -$greenAlpha = a6e3a1 - -$teal = rgb(94e2d5) -$tealAlpha = 94e2d5 - -$sky = rgb(89dceb) -$skyAlpha = 89dceb - -$sapphire = rgb(74c7ec) -$sapphireAlpha = 74c7ec - -$blue = rgb(89b4fa) -$blueAlpha = 89b4fa - -$lavender = rgb(b4befe) -$lavenderAlpha = b4befe - -$text = rgb(cdd6f4) -$textAlpha = cdd6f4 - -$subtext1 = rgb(bac2de) -$subtext1Alpha = bac2de - -$subtext0 = rgb(a6adc8) -$subtext0Alpha = a6adc8 - -$overlay2 = rgb(9399b2) -$overlay2Alpha = 9399b2 - -$overlay1 = rgb(7f849c) -$overlay1Alpha = 7f849c - -$overlay0 = rgb(6c7086) -$overlay0Alpha = 6c7086 - -$surface2 = rgb(585b70) -$surface2Alpha = 585b70 - -$surface1 = rgb(45475a) -$surface1Alpha = 45475a - -$surface0 = rgb(313244) -$surface0Alpha = 313244 - -$base = rgb(1e1e2e) -$baseAlpha = 1e1e2e - -$mantle = rgb(181825) -$mantleAlpha = 181825 - -$crust = rgb(11111b) -$crustAlpha = 11111b