From f784baacfa7dc7c2ca3ab601d21dfdeff5207ec6 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Sun, 17 May 2026 03:39:56 +0545 Subject: [PATCH] migrate to lua for hyprland>=0.55 --- config/hypr/modus.conf | 40 ---------- config/hypr/modus.lua | 75 +++++++++++++++++++ config/matugen/templates/hyprland-colors.conf | 27 ------- config/matugen/templates/hyprland-colors.lua | 5 ++ 4 files changed, 80 insertions(+), 67 deletions(-) delete mode 100644 config/hypr/modus.conf create mode 100644 config/hypr/modus.lua delete mode 100644 config/matugen/templates/hyprland-colors.conf create mode 100644 config/matugen/templates/hyprland-colors.lua diff --git a/config/hypr/modus.conf b/config/hypr/modus.conf deleted file mode 100644 index 11fda2a..0000000 --- a/config/hypr/modus.conf +++ /dev/null @@ -1,40 +0,0 @@ -# exec-once -exec-once = uwsm app -- python ~/.config/Modus/main.py -exec = pgrep -x "hypridle" > /dev/null || uwsm app -- hypridle -exec-once = uwsm app -- swww-daemon -exec-once = wl-paste --type text --watch cliphist store -exec-once = wl-paste --type image --watch cliphist store - - -# LAYER RULES FOR BLURS -layerrule = blur on, xray 0, blur_popups on, ignore_alpha 0, no_anim on, match:namespace ^modus-notifications$ -layerrule = animation popin, match:namespace ^lockscreen$ -layerrule = blur on, xray 0, blur_popups on, ignore_alpha 0, animation popin, match:namespace ^modus-launcher$ -layerrule = blur on, ignore_alpha 0, xray 0, blur_popups on, match:namespace ^fabric$ -layerrule = blur on, xray 0, blur_popups on, ignore_alpha 0, match:namespace ^modus$ -layerrule = animation slide right, match:namespace ^notification-center$ - -# KEYBINDS - -$fabricSend = fabric-cli exec modus -# Reload Modus -bind = SUPER ALT, B, exec, killall modus; uwsm-app $(python $HOME/.config/Modus/main.py) -# Message -bind = SUPER SHIFT, y, exec, $fabricSend 'app.set_css()' # Reload CSS -# # Application Switcher -bind = ALT, TAB, exec, $fabricSend 'switcher.show_switcher()' -# App Launcher -bind = SUPER, SPACE, exec, $fabricSend "launcher.show_launcher()" -# Clipboard History -bind = SUPER, V, exec, $fabricSend "launcher.show_launcher('clip')" -# Wallpapers -bind = SUPER, W, exec, $fabricSend "launcher.show_launcher('wall')" -# Random Wallpaper -bind = ALT SHIFT, W, exec, $fabricSend "launcher.show_launcher('wall random', external=True)" -# Emoji Picker -bind = SUPER, Period, exec, $fabricSend "launcher.show_launcher('em')" -# Power Menu -bind = SUPER, ESCAPE, exec, $fabricSend "launcher.show_launcher('power')" -# Toggle Caffeine -bind = SUPER SHIFT, M, exec, $fabricSend "launcher.show_launcher('caffeine on', external=True)" - diff --git a/config/hypr/modus.lua b/config/hypr/modus.lua new file mode 100644 index 0000000..0e1f14f --- /dev/null +++ b/config/hypr/modus.lua @@ -0,0 +1,75 @@ +local modus = "$HOME/.config/Modus" + +hl.on("hyprland.start", function() + local cmds = { + "uwsm app -- awww-daemon", + "wl-paste --type text --watch cliphist store", + "wl-paste --type image --watch cliphist store", + "pgrep -x hypridle >/dev/null || uwsm app -- hypridle", + "cd " .. modus .. " && uwsm app -- uv run start", + } + for i = 1, #cmds do + local cmd = cmds[i] + hl.exec_cmd(cmd) + end +end) + +-- Layer Rules for Blurs and Animations +local layer_rules = { + { + match = { namespace = "modus-notifications" }, + blur = true, + xray = 0, + blur_popups = true, + ignore_alpha = 0, + no_anim = true, + }, + { match = { namespace = "lockscreen" }, animation = "popin" }, + { + match = { namespace = "modus-launcher" }, + blur = true, + xray = 0, + blur_popups = true, + ignore_alpha = 0, + animation = "popin", + }, + { + match = { namespace = "fabric" }, + blur = true, + ignore_alpha = 0, + xray = 0, + blur_popups = true, + }, + { + match = { namespace = "modus" }, + blur = true, + xray = 0, + blur_popups = true, + ignore_alpha = 0, + }, + { match = { namespace = "notification-center" }, animation = "slide right" }, +} + +for _, rule in ipairs(layer_rules) do + hl.layer_rule(rule) +end + +local fabricSend = "fabric-cli exec modus1" + +-- Reload Modus +hl.bind("SUPER + ALT + B", hl.dsp.exec_cmd("killall modus; cd " .. modus .. " && uwsm app -- uv run start")) + +-- Fabric Launcher Binds +for key, method in pairs({ + ["SUPER + SHIFT + Y"] = "app.set_css()", -- Reload CSS + ["ALT + TAB"] = "switcher.show_switcher()", -- Application Switcher + ["SUPER + SPACE"] = "launcher.show_launcher()", -- App Launcher + ["SUPER + V"] = "launcher.show_launcher('clip')", -- Clipboard History + ["SUPER + W"] = "launcher.show_launcher('wall')", -- Wallpapers + ["ALT + SHIFT + W"] = "launcher.show_launcher('wall random', external=True)", -- Random Wallpaper + ["SUPER + Period"] = "launcher.show_launcher('em')", -- Emoji Picker + ["SUPER + ESCAPE"] = "launcher.show_launcher('power')", -- Power Menu + ["SUPER + SHIFT + M"] = "launcher.show_launcher('caffeine on', external=True)", -- Toggle Caffeine +}) do + hl.bind(key, hl.dsp.exec_cmd(fabricSend .. " '" .. method .. "'")) +end diff --git a/config/matugen/templates/hyprland-colors.conf b/config/matugen/templates/hyprland-colors.conf deleted file mode 100644 index 9aeb090..0000000 --- a/config/matugen/templates/hyprland-colors.conf +++ /dev/null @@ -1,27 +0,0 @@ -$wallpaper = {{image}} -$background = {{colors.background.default.hex_stripped}} -$foreground = {{colors.on_background.default.hex_stripped}} - -$primary = {{colors.primary.default.hex_stripped}} -$secondary = {{colors.secondary.default.hex_stripped}} -$tertiary = {{colors.tertiary.default.hex_stripped}} -$surface = {{colors.surface.default.hex_stripped}} -$surface_bright = {{colors.surface_bright.default.hex_stripped}} -$outline = {{colors.outline.default.hex_stripped}} -$error = {{colors.error.default.hex_stripped | set_lightness: -20.0}} - -$shadow = {{colors.shadow.default.hex_stripped}} - -$red = {{colors.red.default.hex_stripped}} -$green = {{colors.green.default.hex_stripped}} -$yellow = {{colors.yellow.default.hex_stripped}} -$blue = {{colors.blue.default.hex_stripped}} -$magenta = {{colors.magenta.default.hex_stripped}} -$cyan = {{colors.cyan.default.hex_stripped}} -$white = {{colors.white.default.hex_stripped}} -$red_dim = {{colors.red.default.hex_stripped | set_lightness: -20.0}} -$green_dim = {{colors.green.default.hex_stripped | set_lightness: -20.0}} -$yellow_dim = {{colors.yellow.default.hex_stripped | set_lightness: -20.0}} -$blue_dim = {{colors.blue.default.hex_stripped | set_lightness: -20.0}} -$magenta_dim = {{colors.magenta.default.hex_stripped | set_lightness: -20.0}} -$cyan_dim = {{colors.cyan.default.hex_stripped | set_lightness: -20.0}} diff --git a/config/matugen/templates/hyprland-colors.lua b/config/matugen/templates/hyprland-colors.lua new file mode 100644 index 0000000..fc096da --- /dev/null +++ b/config/matugen/templates/hyprland-colors.lua @@ -0,0 +1,5 @@ +return { +<* for name, value in colors *> + {{name}} = "rgb({{value.default.hex_stripped}})", +<* endfor *> +}