Skip to content

Instantly share code, notes, and snippets.

@benyaminl
Created October 14, 2022 06:21
Show Gist options
  • Save benyaminl/256eef9c20a9eb4c7dc6ae272ae8854b to your computer and use it in GitHub Desktop.
Save benyaminl/256eef9c20a9eb4c7dc6ae272ae8854b to your computer and use it in GitHub Desktop.
Show or Hide Spotify Flatpak, can be mapped to Thinkpad X220 ThinkVantage Button on XFCE
#!/bin/bash
STATUS=$(ps -aux | grep share/spotify/spotify | grep -v grep | wc -l)
if [ $STATUS -gt 0 ]
then
activeWindow=$(xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) WM_NAME | cut -d '"' -f 2)
if [[ $activeWindow =~ "Spotify" ]]
then
wmctrl -r "spotify" -b toggle,hidden
else
wmctrl -R Spotify
fi
else
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=spotify --file-forwarding com.spotify.Client @@u %U @@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment