spotify-player: auto-connect to own device on launch
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
16f33c8dd7
commit
3e3e2df6f9
1 changed files with 14 additions and 1 deletions
|
|
@ -88,10 +88,23 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# Upstream ships no .desktop file (TUI only), so the launcher can't find it.
|
# Upstream ships no .desktop file (TUI only), so the launcher can't find it.
|
||||||
|
# The launcher also force-connects to our own librespot device: upstream only
|
||||||
|
# auto-connects when *no* playback exists anywhere on the account
|
||||||
|
# (client/mod.rs `initialize_playback` bails out when playback.is_some()), so
|
||||||
|
# a phone or web player still holding a paused playback means we'd otherwise
|
||||||
|
# have to pick the device by hand every launch. Retry because the device takes
|
||||||
|
# a few seconds to register with Spotify.
|
||||||
xdg.desktopEntries.spotify-player = lib.mkIf isDesktop {
|
xdg.desktopEntries.spotify-player = lib.mkIf isDesktop {
|
||||||
name = "Spotify Player";
|
name = "Spotify Player";
|
||||||
genericName = "Music Player";
|
genericName = "Music Player";
|
||||||
exec = "ghostty --title=spotify-player -e spotify_player";
|
exec = "ghostty --title=spotify-player -e ${pkgs.writeShellScript "spotify-player-connected" ''
|
||||||
|
sp=${config.programs.spotify-player.package}/bin/spotify_player
|
||||||
|
for _ in $(seq 15); do
|
||||||
|
sleep 2
|
||||||
|
"$sp" connect --name spotify-player && break
|
||||||
|
done &
|
||||||
|
exec "$sp"
|
||||||
|
''}";
|
||||||
icon = "spotify";
|
icon = "spotify";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
categories = [ "Audio" "Music" "Player" "AudioVideo" ];
|
categories = [ "Audio" "Music" "Player" "AudioVideo" ];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue