linuxmint / cinnamon

A Linux desktop featuring a traditional layout, built from modern technology and introducing brand new innovative features.
GNU General Public License v2.0
4.48k stars 728 forks source link

Media key play/pause is not send to current media application #10056

Open m0ritz3 opened 3 years ago

m0ritz3 commented 3 years ago

Issue Listen to music via spotify. Then open rhythmbox and listen to music. Close spotify and listen to music again and the function keys play/pause are not processed by spotify anymore. After a fresh reboot the keys work as intended.

Expected behaviour Media keys should be processed by spotify again.

Other information My custom keyboard shortcut for play also does not work, when this problem occurs.

DirkHaar commented 3 years ago

The error message talks about Celluloid. Look up for key binding settings in Celluloid, rhythmbox and general key binding settings.

m0ritz3 commented 3 years ago

I tried to reproduce the error again and this is what happened: 1) Open Spotify to play music and then pause it. 2) Open rhythmbox to play music, then pause the music and close rhythmbox. 3) Start song on Spotify. Pressing the function key now results in rhythmbox playing again. Interestingly, I can recover "normal" behavior by killing the rhythmbox process. This time there was no Celluloid xsessions-error logged. See: xsessions_ohne_celluloid.txt

shmink commented 3 years ago

I get this problem as well. It's after when you log in, the media keys are only going to work for the first program that will play audio.

Even if that's the case, I also find that if I leave my computer and come back and it's gone to screensaver mode then the function keys won't work after that at all.

m0ritz3 commented 3 years ago

As a workaround I use playerctl. The Play-Pause function works reliably so far. I mapped play-pause to Ctrl + Space.

ChrisJan00 commented 2 years ago

Same problem here. I have Brave and Firefox open. Both browsers support MPRIS.

Via the sound applet, I can choose which player to control at a time. The media buttons within the applet work correctly, as expected.

Via System Settings -> Keyboard -> Shortcuts -> Sound and Media, I can assign keyboard shortcuts to the media actions (play, pause, etc.). It works ok as long as there is a single media player running.

But if I have both browsers open, there is no way to choose which player is affected by the shortcuts. They ignore the choice from the sound applet. It seems to be determined by the order in which the players were started. The only way to "switch" player is to close the other one altogether.

This problem happens only with the media keyboard shortcuts; the sound applet behaves as expected.

Using Cinnamon 5.0.6 on Linux Mint 20.2 Cinnamon.

tony1661 commented 2 years ago

Hi, I am having the same issue. I believe the issues is related to csd-media-keys getting confused on which application should be controlled when the Play/Pause button is entered.

I am using "Spot" which is an open-source Spotify controller.

Linux Mint 20.3

Cinnamon 5.2.7

I am using the built-in media applet

This issue can be replicated 100% of the time by doing the following:

1. Launch Spot and start playing a song. 2. The play/pause button will work as expected. 3. Launch Rhythm box (or another app that controls media). You don't need to actually play music of audio etc. 4. The media keys will stop working to control Spot 5. Type in a terminal killall rhythmbox 6. The media keys will start working

Rigel2118 commented 1 year ago

I've used media controls in Ubuntu and its behavior is different from Linux Mint (I believe Ubuntu's media control is the most logical one).

Ubuntu The media keys affect the last compatible media source you used. For example:

  1. Play Spotify, then click play/pause using media key. Spotify will be paused (expected behavior).
  2. Play Rhythmbox, then click play/pause using media key. Rhythmbox will be paused, ie media keys are now linked to Rhythmbox (expected behavior, because it's the last one you used).

Linux Mint The media keys affect the first media source you used and there's no way of changing it unless you close the other sources. For example:

  1. Play Spotify, then click play/pause using media key. Spotify will be paused (expected behavior).
  2. Play Rhythmbox, then click play/pause using media key. Spotify will play audio, ie media keys are still linked to Spotify (weird behavior, since it's the first one you used, not the latest one).

I didn't find anything related in forums, and I would treat this as a bug, because it's annoying that I have to close every player to get the controls of a specific one that I'm using at that moment.

Using Cinnamon 5.8.4 and Linux Mint 21.2 Victoria.

jhargis commented 2 months ago

Mint v.21 5.4.12 latest. This happens multiple times a day for me. I am currently using

killall csd-media-keys && nohup csd-media-keys &

to just get on with it, but it's pretty annoying because of the frequency in which it occurs.

jhargis commented 1 month ago

If I have Spotify playing and the Brave browser open. Some combination or order of events as yet to be determined causes the issue. If I kill csd-media-keys and restart it without backgrounding the process I can see that the controls are indeed being emitted and caught, but they are incorrectly routing to the wrong application. In my case, if I close Brave, Spotify beings receiving the notifications again. This apparently can be controlled under the sound icon in the system tray where there exists "Choose player controls". But when things have gone awry, it has no effect. Hope this extra info is useful somehow.

tony1661 commented 1 month ago

@jhargis I can confirm I have experienced the exact same thing. It's possible with the move to pipwire in the next LM release that this will go away.

I have a workaround here: https://tonyfernandeztech.wordpress.com/2022/08/09/linux-mint-media-keys-not-working/