After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 789738 - Evince interfering with media player keys
Evince interfering with media player keys
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
3.26.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
: 617615 790855 795517 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-10-31 21:23 UTC by Jude D.
Modified: 2018-04-25 13:00 UTC
See Also:
GNOME target: ---
GNOME version: 3.25/3.26


Attachments
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Lollypop alone (46.41 KB, text/plain)
2017-11-15 05:21 UTC, Jude D.
  Details
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Lollypop + Evince (46.06 KB, text/plain)
2017-11-15 05:22 UTC, Jude D.
  Details
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Music (gnome-music) alone (46.40 KB, text/plain)
2017-11-15 05:23 UTC, Jude D.
  Details
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Music (gnome-music) + Evince (46.78 KB, text/plain)
2017-11-15 05:23 UTC, Jude D.
  Details
shell: Fix media-player keys not working (1.25 KB, patch)
2018-01-24 13:12 UTC, Bastien Nocera
committed Details | Review

Description Jude D. 2017-10-31 21:23:29 UTC
Overview:
When Evince (Documents Viewer) is running, playback control using media keys is lost on laptop. Strangely, this only occurs with third-party software (tested with Clementine, Lollypop and Spotify); playback control remains possible with gnome-music.

Steps to reproduce (e.g. using Lollypop):
1) Launch Lollypop;
2) Play some music;
3) Press Play/Pause key on laptop keyboard;
4) Launch Evince;
5) Press Play/Pause key on laptop keyboard.

Expected Results:
Music stops/starts.

Actual Results:
When Evince is running, nothing happens when Play/Pause (or any media key) is pressed.

Build Date & Hardware:
2017-10-31 on Arch Linux running Gnome 3.26.2
Comment 1 Johannes S. 2017-11-12 11:06:45 UTC
I am experiencing the same issues. I am running Arch with Gnome 2.26.2 and Evince 3.26.0.
Comment 2 Germán Poo-Caamaño 2017-11-12 14:13:43 UTC
Does this happen only with Evince or with any other Gnome 3-application? Say, Documents.
Comment 3 Jude D. 2017-11-12 14:17:36 UTC
Everything's fine with Documents. AFAIK it's only an issue with Evince.
Comment 4 Germán Poo-Caamaño 2017-11-12 14:18:37 UTC
Please, may you try with some other applications.
Comment 5 Jude D. 2017-11-12 14:32:01 UTC
At the moment, playback works with all those applications running at the same time:
- Calendar
- Disks
- Documents
- Firefox
- Games
- Geary
- Gedit
- JabRef
- Libreoffice Writer
- MEGASync
- Nautilus
- Pulseeffects
- Recipes
- Settings
- Sound Recorder
- System Monitor
- Tilix
- To Do
- Transmission
- Weather
- Web (Epiphany)

Then, as soon as I launch Evince, the issue appears. However, as I said, playback is still possible whith gnome-music.
Comment 6 Jude D. 2017-11-12 14:34:32 UTC
Sorry, forgot to mention: I am using Lollypop right now.
Comment 7 Germán Poo-Caamaño 2017-11-12 14:42:31 UTC
Thanks for the additional information.

Another question: when this happens, does Evince has the focus? or does this also happen when Evince is running in background?
Comment 8 Jude D. 2017-11-12 14:43:51 UTC
This happens both when Evince is focused and running in background.
Comment 9 Johannes S. 2017-11-12 15:30:57 UTC
It happens whether Evince is in focus or running in background. I am trying to control Spotify and not Lollypop btw. It does not even work when Spotify is in focus, I first have to quit Evince. Then I can use the media keys again.

Keys affected are: Play/Pause, Next and Previous.
Comment 10 Mathias C. 2017-11-14 15:15:41 UTC
I'm experiencing the same issue with Evince and any player which is not Totem. Spotify, Clementine and VLC (so far) lose the media keys bindings (Play/Pause, Next, Previous) as soon Evince is opened. It happens either with Evince in foreground or in background, and even if the player is the focused window.

I'm using ArchLinux with Gnome 3.26.2 and Evince 3.26. It seems that the problem started with the upgrade to Gnome 3.26 as I've been using this installation for the last year without experiencing the issue.

I don't know if it is the same bug, but something similar already happened over the last years:

https://bugzilla.redhat.com/show_bug.cgi?id=1398812
https://bugs.launchpad.net/ubuntu/+source/evince/+bug/263779
Comment 11 Germán Poo-Caamaño 2017-11-14 16:00:15 UTC
Please, may you run gsd-media-keys with G_MESSAGES_DEBUG=all and then run the applications involved.

The definition to run the service is in:
/etc/xdg/autostart/org.gnome.SettingsDaemon.MediaKeys.desktop
Comment 12 Jude D. 2017-11-15 00:36:44 UTC
Lollypop alone: http://pastebin.com/qRUFdsNN

(Start gsd-media-keys; launch Lollypop; play a song; press "Play/Pause" on keyboard; wait 10 s; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.)


Lollypop + Evince: http://pastebin.com/6LjYWaXd

(Start gsd-media-keys; launch Lollypop; play a song; press "Play/Pause" on keyboard; wait 10 s; launch Evince; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.)


Music (gnome-music) alone: http://pastebin.com/4ErdnaSC

(Start gsd-media-keys; launch Music; play a song; press "Play/Pause" on keyboard; wait 10 s; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.)


Music (gnome-music) + Evince: http://pastebin.com/S1vWtx5s

(Start gsd-media-keys; launch Music; play a song; press "Play/Pause" on keyboard; wait 10 s; launch Evince; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.)


Hope this helps.
Comment 13 Germán Poo-Caamaño 2017-11-15 04:40:33 UTC
Thanks for the input. Please, may you attach the output as text files. In the future, the content could be lost or remove by pastebin and there will be lack of context in the report.
Comment 14 Jude D. 2017-11-15 05:21:27 UTC
Created attachment 363654 [details]
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Lollypop alone

Start gsd-media-keys; launch Lollypop; play a song; press "Play/Pause" on keyboard; wait 10 s; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.
Comment 15 Jude D. 2017-11-15 05:22:11 UTC
Created attachment 363655 [details]
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Lollypop + Evince

Start gsd-media-keys; launch Lollypop; play a song; press "Play/Pause" on keyboard; wait 10 s; launch Evince; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.
Comment 16 Jude D. 2017-11-15 05:23:12 UTC
Created attachment 363656 [details]
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Music (gnome-music) alone

Start gsd-media-keys; launch Music; play a song; press "Play/Pause" on keyboard; wait 10 s; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.
Comment 17 Jude D. 2017-11-15 05:23:57 UTC
Created attachment 363657 [details]
Output of G_MESSAGES_DEBUG=all gsd-media-keys for Music (gnome-music) + Evince

Start gsd-media-keys; launch Music; play a song; press "Play/Pause" on keyboard; wait 10 s; launch Evince; press "Play/Pause" on keyboard again; wait 10 s; stop gsd-media-keys.
Comment 18 Johannes S. 2017-11-22 09:48:17 UTC
Downgrading to 3.20.1 resolved the issue for me, so the regression happened somewhere between 3.20.1 and 3.26.0, I suppose.
Comment 19 Mathias C. 2017-11-22 13:30:08 UTC
I downgraded to 3.24.1-1 on Archlinux and it solved the issue, so I think the window within the regression happened is restricted between 3.24 and 3.26.
Comment 20 Germán Poo-Caamaño 2017-11-22 13:37:02 UTC
Please, try reverting the patch in
https://git.gnome.org/browse/evince/commit/?id=532583427f534b83b51488f34e5552882b042801
Comment 21 Germán Poo-Caamaño 2017-11-22 13:38:29 UTC
Otherwise, if you feel comfortable with git and have a little of patience, you can try to bisect it.
Comment 22 Piotr Drąg 2017-11-26 18:05:01 UTC
*** Bug 790855 has been marked as a duplicate of this bug. ***
Comment 23 Mathias C. 2017-11-27 14:33:34 UTC
(In reply to Germán Poo-Caamaño from comment #20)
> Please, try reverting the patch in
> https://git.gnome.org/browse/evince/commit/
> ?id=532583427f534b83b51488f34e5552882b042801

I haven't tried to revert the commit, but looking at its description, it would affect only the "Next/Previous" shortcuts. The issue we have is more in general with all the media keys, as also the "Play/Pause" shortcut is involved.
Comment 24 john.viklund 2018-01-24 10:02:09 UTC
I've done some testing with the versions, for me 3.25.4 works 3.25.91 doesn't.
So the issue seems to be introduced in 3.25.91.
Comment 25 john.viklund 2018-01-24 10:24:20 UTC
I found the commit that introduced this. Reverting the change made in 0d981170c808f39f55288200b7af25aa28949094 resolves this issue (https://bugzilla.gnome.org/show_bug.cgi?id=786262).
Comment 26 Bastien Nocera 2018-01-24 13:12:40 UTC
Created attachment 367373 [details] [review]
shell: Fix media-player keys not working

gsd-media-keys doesn't have a .service file itself, but responds to the
org.gnome.SettingsDaemon.MediaKeys name nonetheless. This however seems
to mean that signals emitted by gsd-media-keys will not have the
expected sender name. Seeing as the signals come from a proxy we created
ourselves with a well-known name, there's really no need to filter any
further.

This fixes pressed media player keys not doing anything with more recent
versions of gnome-settings-daemon (3.24).
Comment 27 john.viklund 2018-01-24 13:27:04 UTC
(In reply to Bastien Nocera from comment #26)
> Created attachment 367373 [details] [review] [review]
> shell: Fix media-player keys not working
> 
> gsd-media-keys doesn't have a .service file itself, but responds to the
> org.gnome.SettingsDaemon.MediaKeys name nonetheless. This however seems
> to mean that signals emitted by gsd-media-keys will not have the
> expected sender name. Seeing as the signals come from a proxy we created
> ourselves with a well-known name, there's really no need to filter any
> further.
> 
> This fixes pressed media player keys not doing anything with more recent
> versions of gnome-settings-daemon (3.24).

I tried your patch. Now the media keys works inside evince, which it didn't before.
However it did not fix the issue with not being able to control media players while evince is running (tested it with spotify).
Comment 28 Bastien Nocera 2018-01-24 14:01:07 UTC
(In reply to john.viklund from comment #27)
> (In reply to Bastien Nocera from comment #26)
> > Created attachment 367373 [details] [review] [review] [review]
> > shell: Fix media-player keys not working
> > 
> > gsd-media-keys doesn't have a .service file itself, but responds to the
> > org.gnome.SettingsDaemon.MediaKeys name nonetheless. This however seems
> > to mean that signals emitted by gsd-media-keys will not have the
> > expected sender name. Seeing as the signals come from a proxy we created
> > ourselves with a well-known name, there's really no need to filter any
> > further.
> > 
> > This fixes pressed media player keys not doing anything with more recent
> > versions of gnome-settings-daemon (3.24).
> 
> I tried your patch. Now the media keys works inside evince, which it didn't
> before.
> However it did not fix the issue with not being able to control media
> players while evince is running (tested it with spotify).

I can't see spotify's code, but I'll assume that it uses the MPRIS API, rather than gnome-settings-daemon's media-keys API. We currently only send keys to MPRIS clients if there's no client using our own media-keys API.

And before any comments, this has been the case since MPRIS support was added, 4 years ago, so nothing that would have recently broken. It's also when I requested a new property in MPRIS to allow us to be a bit more clever about this:
https://lists.freedesktop.org/archives/mpris/2013q4/000064.html

So, there are 2 ways about this:
- Make gnome-settings-daemon prioritise MPRIS clients, or at least try to handle them based on start time (if not focus time). That's doable, though a little bit complicated
- Make evince only grab media player keys when in presentation mode, but that would break the ability to start presentations when evince is running
Comment 29 Bastien Nocera 2018-01-24 16:27:05 UTC
(In reply to Bastien Nocera from comment #28)
> So, there are 2 ways about this:
> - Make gnome-settings-daemon prioritise MPRIS clients, or at least try to
> handle them based on start time (if not focus time). That's doable, though a
> little bit complicated

I filed https://bugzilla.gnome.org/show_bug.cgi?id=792875 for this. It's simple, but should do the job.
Comment 30 Bastien Nocera 2018-01-28 15:30:41 UTC
Attachment 367373 [details] pushed as 4d2301d - shell: Fix media-player keys not working
for master

Also pushed to gnome-3-24 and gnome-3-26
Comment 31 Jude D. 2018-01-31 01:38:28 UTC
Thanks, but now media keys don't work anymore (at least on my side). :)
I will file a bug report upstream.
Comment 32 Jude D. 2018-01-31 01:39:59 UTC
Nevermind, this must be unrelated.
Comment 33 Germán Poo-Caamaño 2018-04-25 12:59:36 UTC
*** Bug 795517 has been marked as a duplicate of this bug. ***
Comment 34 Germán Poo-Caamaño 2018-04-25 13:00:23 UTC
*** Bug 617615 has been marked as a duplicate of this bug. ***