hyprland: respawn scratchpad + spotify-player on window close

This commit is contained in:
rope 2026-08-16 13:51:25 +01:00
parent 66fb7536e8
commit 7c0098a184

View file

@ -263,6 +263,20 @@ in
hl.layer_rule({ match = { namespace = "quickshell-bar" }, blur = true, ignore_alpha = 0.3 }) hl.layer_rule({ match = { namespace = "quickshell-bar" }, blur = true, ignore_alpha = 0.3 })
hl.layer_rule({ match = { namespace = "quickshell-osd" }, blur = true, ignore_alpha = 0.3 }) hl.layer_rule({ match = { namespace = "quickshell-osd" }, blur = true, ignore_alpha = 0.3 })
-- Scratchpad respawn: both special-workspace terminals are meant to
-- exist for the whole session, so SUPER+Q on them reads as "reset
-- this thing", not "close it". Relaunch on close.
local scratchpads = {
["scratchpad"] = "ghostty --title=scratchpad",
["spotify-player"] = "ghostty --title=spotify-player -e spotify_player",
}
local shutting_down = false
hl.on("hyprland.shutdown", function() shutting_down = true end)
hl.on("window.close", function(win)
local cmd = scratchpads[win.title]
if cmd and not shutting_down then hl.exec_cmd(cmd) end
end)
-- Startup -- Startup
hl.on("hyprland.start", function() hl.on("hyprland.start", function()
-- Ensure hyprland-session.target starts even if HM's -- Ensure hyprland-session.target starts even if HM's