This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Shortcuts for Spotify (global)

Tags: None
(comma "," separated)
markus2107
Registered Member
Posts
32
Karma
0
OS

Shortcuts for Spotify (global)

Thu Sep 13, 2012 4:30 pm
Hey,

lately i've noticed, that my spotify shortcuts wont work anymore.
So i've tried to make it work again, but i failed. Mainly i did, what is discribed here.

Nevertheless, i'm not able to make these shortcuts global. I tried it with amarok, and there the global shortcuts are working perfectly...
I've no idea what i've overseen.

EDIT:
I found this on the Arch-Wikibut i dont know what to do with the
second code...

Well the first code i put as musickeys.sh into /bin, but where to should i put the second one? And has this still anything to do with the *.khotkeys trick
i found first?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Sun Sep 23, 2012 3:57 am
The KHotKeys method is the KDE native method, and should definitely be preferred. First, make sure that the shortcuts you would have imported into KDE are actually enabled. Second, make sure the shortcuts are pointed to the location your Spotify script is on your system.

Finally, make sure KHotKeys is enabled in System Settings > Startup & Shutdown > Service Manager. Please make sure "Input Actions" is checked in particular (do not uncheck any of the others however, as they are important to the proper functioning of a Plasma workspace).


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
markus2107
Registered Member
Posts
32
Karma
0
OS

Re: Shortcuts for Spotify (global)

Thu Sep 27, 2012 8:17 pm
bcooksley wrote:Second, make sure the shortcuts are pointed to the location your Spotify script is on your system.


Sorry, but i don't really know what you mean by that. Could you please explain further?

And
bcooksley wrote:Finally, make sure KHotKeys is enabled in System Settings > Startup & Shutdown > Service Manager. Please make sure "Input Actions" is checked in particular (do not uncheck any of the others however, as they are important to the proper functioning of a Plasma workspace).

I don't really know, wheather "Input Actions" is enabled. At least there is no box unchecked and a service that could be translated as "keyboard-shortcuts" is enabled ("Tastenkombinationen").

Thanks for your help.

PS: When i set all the shortcuts as "global shortcuts" > "khotkeys" undefined, the shortcuts at least work when spotify is the active window...
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Fri Sep 28, 2012 11:52 pm
Open System Settings > Shortcuts and Gestures > Custom Shortcuts. In the left panel, do the following for each of the Spotify shortcuts (it probably created a folder):
- On the Trigger tab, reset the shortcut to ensure it is set properly
- On the Action tab, make sure the command it refers to exists on your system. You can disregard everything after the first space. Dolphin or Konqueror would be suitable for this.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
markus2107
Registered Member
Posts
32
Karma
0
OS

Re: Shortcuts for Spotify (global)

Mon Oct 01, 2012 6:26 pm
I'm really sorry, but i don't know what that means: "On the Action tab, make sure the command it refers to exists on your system. You can disregard everything after the first space. Dolphin or Konqueror would be suitable for this."

I made a screenshot, so you can see how it looks on my side

http://imageshack.us/photo/my-images/692/shortcutj.jpg/
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Fri Oct 05, 2012 5:38 am
Oh, I expected it to use a command, it is instead using a D-Bus action.
That is harder to verify. With the Spotify player running, I would suggest using the D-Bus Browser to verify that org.mpris.MediaPlayer2.spotify actually exists.

Please be aware that will not exist if the Spotify player is not running.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
markus2107
Registered Member
Posts
32
Karma
0
OS

Re: Shortcuts for Spotify (global)

Mon Oct 08, 2012 5:57 pm
If i understand you, than i should start the dbusviewer and then search for "org.mpris.MediaPlayer2.spotify".

I did so but i wasnt able to find anything, neither "session bus" nor in "system bus"....

here is a screenshot to let you know what i did... http://imageshack.us/photo/my-images/407/shortcut1.jpg/
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Wed Oct 10, 2012 6:10 am
I notice in your second screenshot that the "SpotifyPlayer" shortcuts appear to have been disabled (they are unchecked).
Please make sure they are checked, and the setting is applied.

If it still does not work, please provide the output of the following two commands (again, make sure the Spotify Player application is running, even if in the tray).
Code: Select all
qdbus org.mpris.MediaPlayer2.spotify
qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
markus2107
Registered Member
Posts
32
Karma
0
OS

Re: Shortcuts for Spotify (global)

Wed Oct 10, 2012 1:01 pm
I enabled the shortcuts, and started spotify. If i want them to work at least when spotify window is the acktive window,
i have to disable the khotkeys (set them to none). Then the shortcuts behave just like when spotify-shortcuts are disabled, but khotkeys is set with play/pause, prev/next.

Also here is the output of the commands you suggested. (as i said, the spotify shortcuts are enabled now)

Code: Select all
[markus@MacBook ~]$ qdbus org.mpris.MediaPlayer2.spotify
Error: org.freedesktop.DBus.Error.NoReply
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
[markus@MacBook ~]$ qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2
Error: org.freedesktop.DBus.Error.NoReply
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Fri Oct 12, 2012 5:59 am
Those error messages are not the expected behaviour. They indicate that Spotify is displaying the functionality as available to use, but is not responding when queried using it. Please double check in Spotify that the MPRIS functionality and interaction is enabled.

This also explains why the shortcut keys are not working (except when Spotify is the active window - because then it can handle them directly itself).


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
boast
Registered Member
Posts
86
Karma
0
OS

Re: Shortcuts for Spotify (global)

Sat Oct 13, 2012 3:47 am
heres how I have mine set up:

http://imgur.com/pQjU2
markus2107
Registered Member
Posts
32
Karma
0
OS

Re: Shortcuts for Spotify (global)

Mon Oct 15, 2012 8:43 pm
Thanks for your help, guys.

But I'm still not getting any further...

I tried boast's shortcut command, but it's still the same :/

bcooksley, could you please discribe, how i can do this:
"Please double check in Spotify that the MPRIS functionality and interaction is enabled."
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Tue Oct 16, 2012 7:34 am
This should be an option inside the Spotify application. I don't have access to the Spotify application, so I cannot check myself.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
markus2107
Registered Member
Posts
32
Karma
0
OS
Ok, I've found a solution:

made the musickeys.sh script from the Arch-Wiki and then did new global shortcuts under kde,
wich did the following

/bin/musickeys.sh play
/bin/musickeys.sh next
and
/bin/musickeys,sh prev

just in case someone else has the same problem ;)

Edit: this is how your musickeys.sh should look like
Code: Select all
#!/bin/sh

case $1 in
   "play")
       key="XF86AudioPlay"
       ;;
   "next")
       key="XF86AudioNext"
       ;;
   "prev")
       key="XF86AudioPrev"
       ;;
   *)
       echo "Usage: $0 play|next|prev"
       exit 1
        ;;
esac
xdotool key --window $(xdotool search --name "Spotify Premium - Linux Preview"|head -n1) $key
exit 0


(found on the arch-wiki entry for spotify https://wiki.archlinux.org/index.php/Sp ... ia_Hotkeys)

Last edited by markus2107 on Sat Oct 20, 2012 10:58 am, edited 1 time in total.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Shortcuts for Spotify (global)

Fri Oct 19, 2012 2:02 am
Marked as Solved. Good to see you found a solution. Would you mind posting a link to the Arch wiki page which lists the musickeys.sh script for other users who are searching for a similar solution in the future?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar