Last active
July 19, 2023 18:55
-
-
Save sh4dowb/aa2471d5799b706a22850c522c366776 to your computer and use it in GitHub Desktop.
linux spotify media keys are sometimes not working after another media is played, and spotify is restarted. this command fixes it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbus-monitor | grep --line-buffered interface=org.mpris.MediaPlayer2.Player | grep --line-buffered -v spotify | awk -W interactive -F'member=' '{print $2}' | xargs -L1 -I {} dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.{} | |
# when you play another media, and restart spotify, media keys get sent to another destination. | |
# in my case, it was VLC. output from dbus-monitor: | |
# | |
# method call time=1586780292.910122 sender=:1.58 -> destination=org.mpris.MediaPlayer2.vlc serial=1878 path=/org/mpris/MediaPlayer2; interface=org.mpris.MediaPlayer2.Player; member=PlayPause | |
# so I piped together a few commands, which got the wrong dbus output, and forwarded it to spotify. | |
# run: | |
# bash spotify-media-key-fix.sh & | |
# edit: if u get error awk: option `-W interactive' unrecognized, ignored | |
# replace awk with mawk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment