9bc180c1a52f0bde65c531709ba72440eebf5afd

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Migrate hyprland to lua config

Diff

This diff is truncated to protect this page.

  1diff --git a/config_template.yaml b/config_template.yaml
  2index 3670cd99755a055d42983bb7f89fd2133cec39fd..dded9014ffd5177898f8045e6f2a703a3566ff2a 100644
  3--- a/config_template.yaml
  4+++ b/config_template.yaml
  5@@ -5,12 +5,16 @@ data:
  6   yubikeyring: false
  7   hyprland:
  8     monitors:
  9-      identifier: "resolution@refresh_rate, auto, 1, vrr, 0"
 10+      identifier:
 11+        mode: "resolution@refresh_rate"
 12+        position: "auto"
 13+        scale: 1
 14+        vrr: 0
 15     input:
 16-      keyboard_layouts: |-
 17-        kb_layout = us,rs,rs,de
 18-        kb_variant = ,latinunicode,,
 19-      sensitivity: "1"
 20+      keyboard_layouts:
 21+        layout: "us,rs,rs,de"
 22+        variant: ",latinunicode,,"
 23+      sensitivity: 1
 24   waybar:
 25     top:
 26       extra_modules: ""
 27diff --git a/dot_config/hypr/hypridle.conf.tmpl b/dot_config/hypr/hypridle.conf.tmpl
 28index a32b2ee02464a0b652adef502a5367eb6088bc4a..96544ffc9afd1080e44394fd13950c428a4eaa35 100644
 29--- a/dot_config/hypr/hypridle.conf.tmpl
 30+++ b/dot_config/hypr/hypridle.conf.tmpl
 31@@ -2,15 +2,15 @@
 32 
 33 listener {
 34     timeout = 120
 35-    on-timeout = hyprctl dispatch dpms off
 36-    on-resume = hyprctl dispatch dpms on
 37+    on-timeout = hyprctl dispatch 'hl.dsp.dpms({ action = "disable" })'
 38+    on-resume = hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })'
 39 }
 40 {{- if index (index .hyprland "hypridle" | default dict) "auto_suspend" | default false }}
 41 
 42 general {
 43     lock_cmd = pidof hyprlock || hyprlock
 44     before_sleep_cmd = loginctl lock-session
 45-    after_sleep_cmd = hyprctl dispatch dpms on
 46+    after_sleep_cmd = hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })'
 47 }
 48 
 49 listener {
 50diff --git a/dot_config/hypr/hyprland.conf.tmpl b/dot_config/hypr/hyprland.conf.tmpl
 51deleted file mode 100644
 52index 3bb610b2fc8e206289efd3df358c3a3aa5894edd..0000000000000000000000000000000000000000
 53--- a/dot_config/hypr/hyprland.conf.tmpl
 54+++ /dev/null
 55@@ -1,384 +0,0 @@
 56-# vim: set ft=hyprlang:
 57-
 58-# https://wiki.hyprland.org/Configuring/Keywords/
 59-
 60-# debug {
 61-#     disable_logs = false
 62-# }
 63-
 64-$active_bg = rgba(504945ff)
 65-$inactive_bg = rgba(282828ff)
 66-
 67-# https://wiki.hyprland.org/Configuring/Monitors/
 68-{{ range $id, $settings := .hyprland.monitors }}monitorv2 {
 69-    output = {{$id}}
 70-    {{- range $key, $value := $settings }}
 71-    {{$key}} = {{$value}}
 72-    {{- end }}
 73-}
 74-{{ end }}
 75-# https://wiki.hyprland.org/Configuring/Variables/
 76-$terminal = ghostty
 77-$menu = fuzzel "--launch-prefix=uwsm app --"
 78-$animation_speed = 1
 79-
 80-# exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
 81-exec-once = hyprpm reload -n
 82-
 83-exec-once = uwsm app -- firefox.desktop
 84-exec-once = uwsm app -- org.telegram.desktop.desktop
 85-exec-once = uwsm app -- signal.desktop
 86-exec-once = uwsm app -- supersonic-desktop.desktop
 87-
 88-# https://wiki.hyprland.org/Configuring/Variables/#general
 89-general {
 90-    layout = hy3
 91-    gaps_in = 0
 92-    gaps_out = 0
 93-    border_size = 2
 94-
 95-    # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
 96-    col.active_border = $active_bg
 97-    col.inactive_border = $inactive_bg
 98-
 99-    # Set to true enable resizing windows by clicking and dragging on borders and gaps
100-    resize_on_border = false
101-
102-    # https://wiki.hyprland.org/Configuring/Tearing/
103-    allow_tearing = true
104-}
105-
106-plugin {
107-    hy3 {
108-        # policy controlling what happens when a node is removed from a group,
109-        # leaving only a group
110-        # 0 = remove the nested group
111-        # 1 = keep the nested group
112-        # 2 = keep the nested group only if its parent is a tab group
113-        node_collapse_policy = 2
114-
115-        # offset from group split direction when only one window is in a group
116-        group_inset = 10
117-
118-        # if a tab group will automatically be created for the first window spawned in a workspace
119-        tab_first_window = false
120-
121-        # tab group settings
122-        tabs {
123-            # height of the tab bar
124-            height = 26
125-
126-            # padding between the tab bar and its focused node
127-            padding = 0
128-            # the tab bar should animate in/out from the top instead of below the window
129-            from_top = true
130-            radius = 0
131-            blur = false
132-            no_gaps_when_only = true
133-
134-            # Window title text
135-            text_center = false
136-            text_font = IosevkaTerm NFP
137-            text_height = 14
138-            text_padding = 6 # left padding
139-
140-            colors {
141-                # active tab bar segment colors
142-                active = $active_bg
143-                active_border = $active_bg
144-                active_text = rgba(ebdbb2ff)
145-
146-                # focused tab bar segment colors (focused node in unfocused container)
147-                focused = rgba(504945ff)
148-                focused_border = rgba(504945ff)
149-                focused_text = rgba(ebdbb2ff)
150-
151-                # urgent tab bar segment colors
152-                urgent = rgba(d79921ff)
153-                urgent_border = rgba(d79921ff)
154-                urgent_text = rgba(282828ff)
155diff --git a/dot_config/hypr/hyprland.lua.tmpl b/dot_config/hypr/hyprland.lua.tmpl
156new file mode 100644
157index 0000000000000000000000000000000000000000..9b3009ccd44670d22d09ec1cfaaf9d90dc8768ce
158--- /dev/null
159+++ b/dot_config/hypr/hyprland.lua.tmpl
160@@ -0,0 +1,257 @@
161+-- vim: ft=lua noet
162+
163+local active_bg = "rgba(504945ff)"
164+local inactive_bg = "rgba(282828ff)"
165+
166+{{ range $output, $settings := .hyprland.monitors }}hl.monitor({
167+	output = {{ printf "%q" $output }},
168+	mode = {{ printf "%q" $settings.mode }},
169+	position = {{ printf "%q" $settings.position }},
170+	scale = {{ $settings.scale }},
171+	vrr = {{ $settings.vrr }},
172+})
173+{{ end }}
174+
175+local terminal = "ghostty"
176+local menu = "fuzzel '--launch-prefix=uwsm app --'"
177+local animation_speed = 1
178+local mod = "SUPER"
179+
180+hl.config({
181+	general = {
182+		layout = "hy3",
183+		gaps_in = 0,
184+		gaps_out = 0,
185+		border_size = 2,
186+		col = {
187+			active_border = active_bg,
188+			inactive_border = inactive_bg,
189+		},
190+		resize_on_border = false,
191+		allow_tearing = true,
192+	},
193+	plugin = {
194+		hy3 = {
195+			node_collapse_policy = 2,
196+			group_inset = 10,
197+			tab_first_window = false,
198+			tabs = {
199+				height = 26,
200+				padding = 0,
201+				from_top = true,
202+				radius = 0,
203+				blur = false,
204+				text_center = false,
205+				text_font = "IosevkaTerm NFP",
206+				text_height = 14,
207+				text_padding = 6,
208+				colors = {
209+					active = active_bg,
210+					active_border = active_bg,
211+					active_text = "rgba(ebdbb2ff)",
212+					focused = "rgba(504945ff)",
213+					focused_border = "rgba(504945ff)",
214+					focused_text = "rgba(ebdbb2ff)",
215+					urgent = "rgba(d79921ff)",
216+					urgent_border = "rgba(d79921ff)",
217+					urgent_text = "rgba(282828ff)",
218+					inactive = inactive_bg,
219+					inactive_border = inactive_bg,
220+					inactive_text = "rgba(a89984ff)",
221+				},
222+			},
223+		},
224+	},
225+	decoration = {
226+		rounding = 0,
227+		active_opacity = 1.0,
228+		inactive_opacity = 1.0,
229+		shadow = { enabled = false },
230+		blur = { enabled = false },
231+	},
232+	animations = { enabled = true },
233+	misc = {
234+		font_family = "Noto Sans",
235+		force_default_wallpaper = 1,
236+		disable_hyprland_logo = true,
237+		enable_swallow = true,
238+		swallow_regex = "com.mitchellh.ghostty",
239+		mouse_move_enables_dpms = true,
240+		key_press_enables_dpms = true,
241+		disable_splash_rendering = true,
242+	},
243+	xwayland = { force_zero_scaling = true },
244+	ecosystem = { no_update_news = true },
245+	render = {
246+		direct_scanout = 2,
247+		cm_auto_hdr = 2,
248+	},
249+	cursor = { hotspot_padding = 0 },
250+	input = {
251+		kb_layout = {{ printf "%q" .hyprland.input.keyboard_layouts.layout }},
252+		kb_variant = {{ printf "%q" .hyprland.input.keyboard_layouts.variant }},
253+		follow_mouse = 1,
254+		sensitivity = {{ .hyprland.input.sensitivity }},
255+		touchpad = {
256+			natural_scroll = false,
257+			drag_lock = false,
258+		},
259+	},