Parent directory

hyprland.lua.tmpl

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