hyprland: wait for DNS before starting spotify_player
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
2ad8c511ee
commit
a2bdce01eb
1 changed files with 17 additions and 1 deletions
|
|
@ -276,7 +276,23 @@ in
|
||||||
-- on them reads as "reset this thing", not "close it".
|
-- on them reads as "reset this thing", not "close it".
|
||||||
local scratchpads = {
|
local scratchpads = {
|
||||||
["dev.fred.scratchpad"] = "ghostty --class=dev.fred.scratchpad --title=scratchpad",
|
["dev.fred.scratchpad"] = "ghostty --class=dev.fred.scratchpad --title=scratchpad",
|
||||||
["dev.fred.spotify"] = "ghostty --class=dev.fred.spotify --title=spotify-player -e spotify_player",
|
-- 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
|
||||||
|
''}",
|
||||||
}
|
}
|
||||||
local shutting_down = false
|
local shutting_down = false
|
||||||
hl.on("hyprland.shutdown", function() shutting_down = true end)
|
hl.on("hyprland.shutdown", function() shutting_down = true end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue