quickshell: open wallpaper dropdown on hover-switch like other menus
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
c87b40d528
commit
9447413fa1
6 changed files with 35 additions and 224 deletions
|
|
@ -263,8 +263,8 @@ in
|
|||
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 })
|
||||
|
||||
-- Both special-workspace terminals get their own --class, which does
|
||||
-- two things ghostty's --title cannot. First, gtk-single-instance
|
||||
-- The scratchpad terminal gets its own --class, which does two
|
||||
-- things ghostty's --title cannot. First, gtk-single-instance
|
||||
-- means a second `ghostty` hands its request to the running instance
|
||||
-- and exits; forwarded requests keep -e but DROP --title, so the
|
||||
-- window ends up named by the shell and no title rule matches it.
|
||||
|
|
@ -276,28 +276,15 @@ in
|
|||
-- on them reads as "reset this thing", not "close it".
|
||||
local scratchpads = {
|
||||
["dev.fred.scratchpad"] = "ghostty --class=dev.fred.scratchpad --title=scratchpad",
|
||||
-- Waits for DNS before starting spotify_player. If its cached Web
|
||||
-- API token cannot be refreshed it falls back to an interactive
|
||||
-- browser login (auth.rs: the refresh `Err` arm re-runs the PKCE
|
||||
-- flow), and a "network unreachable" refresh counts as failure —
|
||||
-- so starting at hyprland.start, before the link is up, meant a
|
||||
-- browser window and a fresh Spotify login on every single boot.
|
||||
-- Costs nothing once the network is up, and also covers the
|
||||
-- respawn path firing right after a resume.
|
||||
["dev.fred.spotify"] = "${pkgs.writeShellScript "spotify-player-scratchpad" ''
|
||||
n=0
|
||||
while [ $n -lt 60 ]; do
|
||||
${pkgs.glibc.bin}/bin/getent hosts accounts.spotify.com >/dev/null 2>&1 && break
|
||||
${pkgs.coreutils}/bin/sleep 1
|
||||
n=$((n + 1))
|
||||
done
|
||||
exec ghostty --class=dev.fred.spotify --title=spotify-player -e spotify_player
|
||||
''}",
|
||||
-- Spotify sets its own class, so no --class trick here; the
|
||||
-- lookup below lowercases before falling back, which covers both
|
||||
-- the Wayland app id and the XWayland "Spotify".
|
||||
["spotify"] = "spotify",
|
||||
}
|
||||
local shutting_down = false
|
||||
hl.on("hyprland.shutdown", function() shutting_down = true end)
|
||||
hl.on("window.close", function(win)
|
||||
local cmd = scratchpads[win.class]
|
||||
local cmd = scratchpads[win.class] or scratchpads[(win.class or ""):lower()]
|
||||
if cmd and not shutting_down then hl.exec_cmd(cmd) end
|
||||
end)
|
||||
|
||||
|
|
@ -331,10 +318,10 @@ in
|
|||
hl.exec_cmd("wl-paste --type text --watch cliphist store")
|
||||
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
||||
hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24")
|
||||
-- Warms spotify-player's Spotify Connect device while you're
|
||||
-- doing something else; the window rule above swallows it onto
|
||||
-- special:music silently, so it never steals focus.
|
||||
hl.exec_cmd(scratchpads["dev.fred.spotify"])
|
||||
-- Spotify starts hidden: the window rule below swallows it onto
|
||||
-- special:music silently, so it never steals focus and SUPER+M is
|
||||
-- always an instant toggle.
|
||||
hl.exec_cmd(scratchpads["spotify"])
|
||||
-- Scratchpad terminal, same trick: parked on special:scratch at
|
||||
-- login so SUPER+Return is always an instant toggle and the shell
|
||||
-- keeps its history/cwd between peeks.
|
||||
|
|
@ -377,16 +364,11 @@ in
|
|||
workspace = "special silent",
|
||||
})
|
||||
|
||||
-- spotify-player lives on a special workspace for its whole
|
||||
-- session. Its librespot device takes ~20s to be accepted by
|
||||
-- Spotify's backend, and that cost is per *process*, so relaunching
|
||||
-- a terminal for it means waiting every time. Parking one instance
|
||||
-- here pays it once at login; SUPER+M slides it in and out.
|
||||
-- Matched on the dedicated --class set above, not on title: a shell
|
||||
-- prompt rewrites its window title, and forwarded single-instance
|
||||
-- launches never carry --title in the first place.
|
||||
-- Spotify lives on a special workspace for its whole session;
|
||||
-- SUPER+M slides it in and out. Matched on class, not title: the
|
||||
-- title carries the current track.
|
||||
hl.window_rule({
|
||||
match = { class = "^dev.fred.spotify$" },
|
||||
match = { class = "^[Ss]potify$" },
|
||||
workspace = "special:music silent",
|
||||
})
|
||||
|
||||
|
|
@ -397,15 +379,15 @@ in
|
|||
-- same reason as above, and because matching on the special
|
||||
-- workspace would depend on the assignment rule running first.
|
||||
hl.window_rule({
|
||||
name = "spotify-player-inset",
|
||||
match = { class = "^dev.fred.spotify$" },
|
||||
name = "spotify-inset",
|
||||
match = { class = "^[Ss]potify$" },
|
||||
float = true,
|
||||
size = "80% 80%",
|
||||
center = true,
|
||||
})
|
||||
|
||||
-- Scratchpad terminal — same class-match + float-to-inset pattern as
|
||||
-- spotify-player above.
|
||||
-- Spotify above.
|
||||
hl.window_rule({
|
||||
match = { class = "^dev.fred.scratchpad$" },
|
||||
workspace = "special:scratch silent",
|
||||
|
|
@ -471,7 +453,7 @@ in
|
|||
hl.bind(mod .. " + F", hl.dsp.window.fullscreen())
|
||||
hl.bind(mod .. " + P", hl.dsp.window.pseudo())
|
||||
hl.bind(mod .. " + S", hl.dsp.layout("togglesplit"))
|
||||
hl.bind(mod .. " + M", toggle_scratchpad("music", "dev.fred.spotify"))
|
||||
hl.bind(mod .. " + M", toggle_scratchpad("music", "^[Ss]potify$"))
|
||||
hl.bind(mod .. " + Return", toggle_scratchpad("scratch", "dev.fred.scratchpad"))
|
||||
|
||||
-- Focus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue