hyprland.lua.tmpl
10511 bytes
1-- vim: ft=lua noet
2
3local active_bg = "rgba(504945ff)"
4local inactive_bg = "rgba(282828ff)"
5
6{{ range $output, $settings := .hyprland.monitors }}hl.monitor({
7 output = {{ printf "%q" $output }},
8 mode = {{ printf "%q" $settings.mode }},
9 position = {{ printf "%q" $settings.position }},
10 scale = {{ $settings.scale }},
11 vrr = {{ $settings.vrr }}{{ if hasKey $settings "bitdepth" }},
12 bitdepth = {{ $settings.bitdepth }},{{ end }}
13})
14
15{{ end -}}
16
17local terminal = "ghostty"
18local menu = "fuzzel '--launch-prefix=uwsm app --'"
19local animation_speed = 1
20local mod = "SUPER"
21
22hl.config({
23 general = {
24 layout = "hy3",
25 gaps_in = 0,
26 gaps_out = 0,
27 border_size = 2,
28 col = {
29 active_border = active_bg,
30 inactive_border = inactive_bg,
31 },
32 resize_on_border = false,
33 allow_tearing = true,
34 },
35 plugin = {
36 hy3 = {
37 node_collapse_policy = 2,
38 group_inset = 10,
39 tab_first_window = false,
40 tabs = {
41 height = 26,
42 padding = 0,
43 from_top = true,
44 radius = 0,
45 blur = false,
46 text_center = false,
47 text_font = "IosevkaTerm NFP",
48 text_height = 14,
49 text_padding = 6,
50 colors = {
51 active = active_bg,
52 active_border = active_bg,
53 active_text = "rgba(ebdbb2ff)",
54 focused = "rgba(504945ff)",
55 focused_border = "rgba(504945ff)",
56 focused_text = "rgba(ebdbb2ff)",
57 urgent = "rgba(d79921ff)",
58 urgent_border = "rgba(d79921ff)",
59 urgent_text = "rgba(282828ff)",
60 inactive = inactive_bg,
61 inactive_border = inactive_bg,
62 inactive_text = "rgba(a89984ff)",
63 },
64 },
65 },
66 },
67 decoration = {
68 rounding = 0,
69 active_opacity = 1.0,
70 inactive_opacity = 1.0,
71 shadow = { enabled = false },
72 blur = { enabled = false },
73 },
74 animations = { enabled = true },
75 misc = {
76 font_family = "Noto Sans",
77 force_default_wallpaper = 1,
78 disable_hyprland_logo = true,
79 enable_swallow = false,
80 mouse_move_enables_dpms = true,
81 key_press_enables_dpms = true,
82 disable_splash_rendering = true,
83 },
84 xwayland = { force_zero_scaling = true },
85 ecosystem = { no_update_news = true },
86 render = {
87 direct_scanout = 0,
88 cm_auto_hdr = 2,
89 },
90 quirks = {
91 prefer_hdr = 2,
92 },
93 cursor = { hotspot_padding = 0 },
94 input = {
95 kb_layout = {{ printf "%q" .hyprland.input.keyboard_layouts.layout }},
96 kb_variant = {{ printf "%q" .hyprland.input.keyboard_layouts.variant }},
97 follow_mouse = 1,
98 sensitivity = {{ .hyprland.input.sensitivity }},
99 touchpad = {
100 natural_scroll = false,
101 drag_lock = false,
102 },
103 },
104 gestures = { workspace_swipe_touch = false },
105})
106
107hl.curve("easeOutQuint", { type = "bezier", points = { { 0.23, 1 }, { 0.32, 1 } } })
108hl.curve("easeInOutCubic", { type = "bezier", points = { { 0.65, 0.05 }, { 0.36, 1 } } })
109hl.curve("linear", { type = "bezier", points = { { 0, 0 }, { 1, 1 } } })
110hl.curve("almostLinear", { type = "bezier", points = { { 0.5, 0.5 }, { 0.75, 1 } } })
111hl.curve("quick", { type = "bezier", points = { { 0.15, 0 }, { 0.1, 1 } } })
112
113hl.animation({ leaf = "global", enabled = true, speed = animation_speed, bezier = "default" })
114hl.animation({ leaf = "border", enabled = true, speed = animation_speed, bezier = "easeOutQuint" })
115hl.animation({ leaf = "windows", enabled = true, speed = animation_speed, bezier = "easeOutQuint" })
116hl.animation({
117 leaf = "windowsIn",
118 enabled = true,
119 speed = animation_speed,
120 bezier = "easeOutQuint",
121 style = "popin 87%",
122})
123hl.animation({ leaf = "windowsOut", enabled = true, speed = animation_speed, bezier = "linear", style = "popin 87%" })
124hl.animation({ leaf = "fadeIn", enabled = true, speed = animation_speed, bezier = "almostLinear" })
125hl.animation({ leaf = "fadeOut", enabled = true, speed = animation_speed, bezier = "almostLinear" })
126hl.animation({ leaf = "fade", enabled = true, speed = animation_speed, bezier = "quick" })
127hl.animation({ leaf = "layers", enabled = true, speed = animation_speed, bezier = "easeOutQuint" })
128hl.animation({ leaf = "layersIn", enabled = true, speed = animation_speed, bezier = "easeOutQuint", style = "fade" })
129hl.animation({ leaf = "layersOut", enabled = true, speed = animation_speed, bezier = "linear", style = "fade" })
130hl.animation({ leaf = "fadeLayersIn", enabled = true, speed = animation_speed, bezier = "almostLinear" })
131hl.animation({ leaf = "fadeLayersOut", enabled = true, speed = animation_speed, bezier = "almostLinear" })
132hl.animation({ leaf = "workspaces", enabled = true, speed = animation_speed, bezier = "almostLinear", style = "fade" })
133hl.animation({ leaf = "workspacesIn", enabled = true, speed = animation_speed, bezier = "almostLinear", style = "fade" })
134hl.animation({
135 leaf = "workspacesOut",
136 enabled = true,
137 speed = animation_speed,
138 bezier = "almostLinear",
139 style = "fade",
140})
141
142hl.on("hyprland.start", function()
143 hl.exec_cmd("hyprpm reload -n")
144 hl.exec_cmd("uwsm app -- firefox.desktop")
145 hl.exec_cmd("uwsm app -- supersonic-desktop.desktop")
146 {{- if not (index . "work") | default false }}
147 hl.exec_cmd("uwsm app -- org.telegram.desktop.desktop")
148 hl.exec_cmd("uwsm app -- signal.desktop")
149 {{- end }}
150end)
151
152hl.bind(mod .. " + SHIFT + Q", hl.plugin.hy3.kill_active())
153hl.bind(mod .. " + SHIFT + X", hl.dsp.exec_cmd('loginctl terminate-session "$XDG_SESSION_ID"'))
154hl.bind(mod .. " + CTRL + L", hl.dsp.exec_cmd("hyprlock"))
155
156hl.bind(mod .. " + Space", hl.dsp.exec_cmd(menu))
157hl.bind(mod .. " + BackSpace", hl.dsp.exec_cmd(menu))
158hl.bind(mod .. " + J", hl.dsp.exec_cmd("BEMOJI_PICKER_CMD='fuzzel -d' bemoji"))
159hl.bind(mod .. " + D", hl.dsp.exec_cmd("fuzzel '--launch-prefix=uwsm app --'"))
160hl.bind(mod .. " + Return", hl.dsp.exec_cmd("uwsm app -- " .. terminal .. " +new-window"))
161hl.bind(
162 mod .. " + A",
163 hl.dsp.exec_cmd(
164 "echo 'start' | /usr/bin/socat - UNIX-CONNECT:$XDG_RUNTIME_DIR/whisper-dictate/whisper-dictate.sock"
165 )
166)
167hl.bind(
168 mod .. " + A",
169 hl.dsp.exec_cmd("echo 'stop' | /usr/bin/socat - UNIX-CONNECT:$XDG_RUNTIME_DIR/whisper-dictate/whisper-dictate.sock"),
170 { release = true }
171)
172
173hl.bind(mod .. " + H", hl.plugin.hy3.move_focus("left"))
174hl.bind(mod .. " + I", hl.plugin.hy3.move_focus("right"))
175hl.bind(mod .. " + E", hl.plugin.hy3.move_focus("up"))
176hl.bind(mod .. " + N", hl.plugin.hy3.move_focus("down"))
177
178hl.bind(mod .. " + SHIFT + H", hl.plugin.hy3.move_window("left"))
179hl.bind(mod .. " + SHIFT + I", hl.plugin.hy3.move_window("right"))
180hl.bind(mod .. " + SHIFT + E", hl.plugin.hy3.move_window("up"))
181hl.bind(mod .. " + SHIFT + N", hl.plugin.hy3.move_window("down"))
182
183hl.bind(mod .. " + F", hl.dsp.window.fullscreen())
184hl.bind(mod .. " + SHIFT + Space", hl.dsp.window.float())
185hl.bind(mod .. " + SHIFT + BackSpace", hl.dsp.window.float())
186hl.bind(mod .. " + S", hl.plugin.hy3.change_group("opposite"))
187hl.bind(mod .. " + T", hl.plugin.hy3.change_group("toggletab"))
188hl.bind(mod .. " + V", hl.plugin.hy3.make_group("v", { ephemeral = true }))
189hl.bind(mod .. " + C", hl.plugin.hy3.make_group("h", { ephemeral = true }))
190
191for workspace, key in ipairs({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "W", "P", "M", "O" }) do
192 hl.bind(mod .. " + " .. key, hl.dsp.focus({ workspace = workspace }))
193 hl.bind(mod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = workspace, follow = false }))
194end
195
196hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
197hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
198
199hl.bind(
200 "XF86AudioRaiseVolume",
201 hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%+"),
202 { locked = true, repeating = true }
203)
204hl.bind(
205 "XF86AudioLowerVolume",
206 hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 2%-"),
207 { locked = true, repeating = true }
208)
209hl.bind(
210 "SHIFT + XF86AudioRaiseVolume",
211 hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 8%+"),
212 { locked = true, repeating = true }
213)
214hl.bind(
215 "SHIFT + XF86AudioLowerVolume",
216 hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 8%-"),
217 { locked = true, repeating = true }
218)
219hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true })
220hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true })
221hl.bind(mod .. " + ALT + M", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"))
222hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl-wrapper pause"), { locked = true })
223hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl-wrapper play-pause"), { locked = true })
224hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl-wrapper previous"), { locked = true })
225hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl-wrapper next"), { locked = true })
226hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("light -A 10"), { locked = true, repeating = true })
227hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("light -U 10"), { locked = true, repeating = true })
228hl.bind("SHIFT + XF86MonBrightnessUp", hl.dsp.exec_cmd("light -A 1"), { locked = true, repeating = true })
229hl.bind("SHIFT + XF86MonBrightnessDown", hl.dsp.exec_cmd("light -U 1"), { locked = true, repeating = true })
230hl.bind("Print", hl.dsp.exec_cmd("hyprshot -z -m region --clipboard-only"))
231hl.bind("SHIFT + Print", hl.dsp.exec_cmd("hyprshot -z -m region -o /home/pavle/pictures -f screenshot.png"))
232
233hl.window_rule({
234 name = "no-border-workspace-tv1",
235 match = { float = false, workspace = "w[tv1]" },
236 border_size = 0,
237 rounding = 0,
238})
239hl.window_rule({
240 name = "no-border-workspace-f1",
241 match = { float = false, workspace = "f[1]" },
242 border_size = 0,
243 rounding = 0,
244})
245hl.window_rule({
246 name = "suppress-maximize",
247 match = { class = ".*" },
248 suppress_event = "maximize",
249})
250hl.window_rule({
251 name = "xwayland-drag-fix",
252 match = {
253 class = "^$",
254 title = "^$",
255 xwayland = true,
256 float = true,
257 fullscreen = false,
258 pin = false,
259 },
260 no_focus = true,
261})
262hl.window_rule({ name = "wine-systray-special", match = { title = "Wine System Tray" }, workspace = "special silent" })
263hl.window_rule({ name = "steam-workspace", match = { class = "steam" }, workspace = "10 silent" })
264hl.window_rule({ name = "firefox-workspace", match = { class = "firefox" }, workspace = "11 silent" })
265hl.window_rule({ name = "telegram-workspace", match = { class = "org.telegram.desktop" }, workspace = "12 silent" })
266hl.window_rule({ name = "signal-workspace", match = { class = "signal" }, workspace = "12 silent" })
267hl.window_rule({
268 name = "thunderbird-workspace",
269 match = { initial_class = "org.mozilla.Thunderbird" },
270 workspace = "13 silent",
271})
272hl.window_rule({
273 name = "supersonic",
274 match = { initial_class = "io.github.supersonic-app.supersonic" },
275 workspace = "14 silent",
276})