Skip to content

Instantly share code, notes, and snippets.

@chaitunya
Last active May 16, 2023 00:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaitunya/4cf0788283f324394efc361443aee064 to your computer and use it in GitHub Desktop.
Save chaitunya/4cf0788283f324394efc361443aee064 to your computer and use it in GitHub Desktop.
Simple script to automatically go to a Spotify window if it's already open or create a new instance if it's not
#!/usr/bin/bash
pgrep -f /app/extra/share/spotify/spotify
if [ $? = 1 ]; then
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=spotify --file-forwarding com.spotify.Client $*
# Non-flatpak version of spotify:
# spotify $*
else
wmctrl -x -a spotify
fi
@YisusChrist
Copy link

Simple and very efficient. I love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment