GNOME Bugzilla – Bug 547164
Support for media player keys interferes with the music player
Last modified: 2018-02-01 08:52:03 UTC
Please describe the problem: The main goal of media player keys on a keyboard is to allow play/pause/next/previous song without having to go to the music player and coming back. This is especially useful when you read a long document in evince. Now, with the "feature" provided in bug 539971, the multimedia keys are short-circuited, and when I want to pause the music or change tracks, evince goes to presentation mode or change pages! Steps to reproduce: 1. open rhythmbox 2. press the play/pause key 3. open a document in evince 4. press the play/pause key Actual results: Evince goes to presentation mode Expected results: Rhythmbox pauses Does this happen every time? Yes Other information: I guess this feature was done in order to support remote controls when doing presentation. Fine with that, but it should not do anything if a music player is present. I can see two ways to fix this: * Detect that a music/video player is also listening the multimedia keys (on DBus), and disable this feature in this case. * (If the detection is not possible) Have a gconf key that permit to activate/deactivate this feature. By default, it should be deactivated (because the normal meaning of a play key on a keyboard is _not_ to go to presentation mode).
Yeah, I agree. Adding Bastien to CC.
This is only a problem when Evince was the last focused application (when we're focused, we tell the gnome-settings-daemon that we are the application that's supposed to receive the keys). Until evince gets plugins, I don't really see how I could fix that problem without adding a configuration option, which would be a pretty bad way to go.
Having to focus the media player to be able to use the multimedia keys defeats the whole idea of multimedia keys: avoiding to have to change of application. Evince is _not_ a multimedia player, and therefore, should it listen for the multimedia keys, it should do it at a very low priority. What I propose is that when evince get the focus, it first asks g-s-t if there is already some application bound to the key, and only if not, it binds itself. You could in addition add an option to force the binding (in case someone wants to do a presentation with a remote control and a media player in the background and use the remote control for changing the slides), but, I entirely agree with you, adding configuration option should be avoided as much as possible.
There's currently no API for that. You can propose that as an API addition for gnome-settings-daemon if you're willing to do the work. I don't see this bug as a problem myself...
Hummm... I'll have a look at g-s-t. Also you could you give some example scenario of when this "feature" is useful? Is the "remote control scenario" the only scenario? What scenario did you have in mind when implementing this feature?
Created attachment 116304 [details] [review] Grab the mediakeys with a low priority Indeed, g-s-t permits to modify the list of interested applications, but not to read it. Nevertheless, it allows to pass as a second argument: the "time". It gives the grab to the application with the highest time value (and 0 has a special meaning of "even higher"). So by passing a low value, it permits to grab the key only when no other application has requested it. That's what does this patch (with a arbitrary value of 10). This patch also fixes the release message to pass the correct name of the application. However, it seems there is a problem with this part, because the ReleaseMediaPlayerKeys method is never called. You can verify this by running "dbus-monitor". It seems the finalize method is not called. Bastien, care to have a look on this?
I'd use "1" instead of "10" though. ReleaseMediaPlayerKeys is probably never called because the object it belongs to is not disposed of properly (do we take care of cleaning up, or do we just exit?). That makes no difference, the gnome-settings-daemon (fyi, g-s-d, not g-s-t) will notice the application dropped off the bus, so it's as good as.
I put 10, just in case there would be applications which would like to have even lower priority, but 1 should be fine as well! Please feel free to commit the patch with 1 if you prefer :-)
Applied to svn trunk, thanks Eric!
*** Bug 551005 has been marked as a duplicate of this bug. ***
Well with the latest Evince update, Banshee and Rhythmbox get their keys back when Evince exits but while Evince is running they still cannot use them.
Actually it always seems to be the most recent application to request the media keys that gets it. I tried a variety of priorities but none made any difference. Start media player than evince -> evince gets keys. Start evince then media player -> media player gets them.
I'm in favour to make this an option. It is really bad, whenever I have opened a PDF (in my case this is quite often), and can't use the media keys for banshee (or any other media-player). Another option (and probably this is better since it doesn't introduce an config option) is only listening to "next/previous song", and only when in presention mode. If in presentation mode (I assume you are giving a presentation then) the chances are really low that you are indeed "having a media player open that you want to control with a remote" When not in presentation mode (you are just reading a PDF file), evince should't listen to next/previous (probably the keys are used for a media player) Play/pause should't do anything (this you do at the start of your presentation with mouse/keyboard). I hope I was clear enough about my point. On the longer term, when g-s-m has improved (priorities regardless of startup order), we can reintrouduce current behaviour (low priority). Greetings, Nathan
Should we reopen this bug?
I believe it should be reopened. I'm actually pretty annoyed with not being able to control Banshee while reading a PDF (unless I restart Banshee or at least its Media Keys extension).
Please reopen this bug report. IMHO it is stupid for a non-multimedia application to grab the multimedia keys. Even in presentation mode, other solutions should be used. A lot of users are really annoyed with this, including myself. It seems that the only way to prevent evince from "hijacking" the multimedia keys is to compile it without dbus support. This by itself breaks other benign features, which is undesirable. So the very least would be to provide an option to turn off this feature, or better, just turn it off by default.
Renato, this bug belongs to gnome-settings-daemon, and even then it's fixed in the latest upstream version. While Evince grabs the multimedia keys, it does so in a manner that prioritizes media applications first. The actual bug was gnome-settings-daemon not honouring the said priority that was set by Evince.
I believe I'm using the latest stable versions. Is this fixed in the 2.25.x versions? I'm having this problem with the exaile media player. The relevant versions are: gnome-settings-daemon-2.24.1 evince-2.24.2 exaile-0.2.14
Yes, I meant the 2.25.x versions. Exaile and Evince aren't the ones having this bug at your current versions.
Ok, thanks. I still don't like the fact that evince grabs the multimedia keys, but if it works then I'm ok with that. Sorry for the noise.. :)
*** Bug 570539 has been marked as a duplicate of this bug. ***
*** Bug 574063 has been marked as a duplicate of this bug. ***
This is still an issue in 2.26.0. Whenever I have Evince open, I can't use multimedia keys for Play, Paus, Next Track and Previous track.