You are not logged in.

#1 2020-06-25 11:34:03

Wild Penguin
Member
Registered: 2015-03-19
Posts: 319

[SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

Hi,

There is this annoyance which has made media keys near-unusable for me. Recently(/recentlish), it seems they have introduced the ability into Firefox to control media existing on some tab with media keys.

The thing is, I often have several tabs open, and swith 10-50+ tabs open, it is easy to forget (or sometimes, intentionally leave) some media open in background, stopped. Firefox will *always* catch my media keys (play, stop etc. on my keyboard), and I can not find a way to prevent this.

There is the "media player" plasmoid (whatever it is called in English) where I can, supposedly, choose which media player is being controlled, however despite choosing "Clementine", "Spotify" or whatever, Firefox will be controlled instead.

Any ideas how to stop Firefox capturing these keys (or, force the plasmoid catch these no matter what applications want)? For my use case, Firefox listening to media keys is a useless feature, I would rather have it disabled altogether. I *never* watch/listen to anything via Firefox which is not focused, and the main reason I would like to use media keys is controlling background music and *not* need to focus the said application (which is *never* a Firefox tab).

(well, actually "STOP" will always stop whatever is playing at the moment, but "PLAY", most importantly, is catched by whatever I may have open in Firefox; optimally "STOP" should always stop whatever is playing, since that can be useful if one does not know what is playing!).

Only workaround(s) I've found is: I need to close tabs with any media to regain control, or not use media keys and control the application I would like to control the slower way. However, as you can see, this is not optimal...

My searches for solution have come up null. I'd appreciate any ideas!

TL;DR: Firefox tabs with media will be controlled with media keys, I would rather not to.

[/1stworldproblems]

Last edited by Wild Penguin (2020-06-28 18:34:43)

Offline

#2 2020-06-25 13:59:56

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

Try setting  media.hardwaremediakeys.enabled to false through about;config .
See https://www.ghacks.net/2020/03/23/firef … -controls/


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2020-06-25 17:48:27

Wild Penguin
Member
Registered: 2015-03-19
Posts: 319

Re: [SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

Maybe I should have mentioned the first thing I tried was to scour about:config. That is about the only setting I found and it was (and is) already set to "false". Still Firefox uses the media keys.

Thanks, anyways, Lone_Wolf!

Offline

#4 2020-06-26 13:16:37

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

That article mentions another option

Firefox does come with controls to disable the Media Session API as well:

    Set the preference dom.media.mediasession.enabled to FALSE to disable it.

Does doing that help ?


It may be that a firefox extension is responding to those keys.
Goto about:addons , click the gear icon next to 'Manage your extensions' and choose 'manage extension shortcuts' .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2020-06-27 15:07:10

Wild Penguin
Member
Registered: 2015-03-19
Posts: 319

Re: [SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

Hi Lone_Wolf,

I didn't know that setting exists, however even that is already set to false.

I don't have any extensions which should affect media keys / UI in any way, except for Plasma Integration. I will disable that one, and test if it makes a difference (however, as I can see it, things should integrate better, not worse, into Plasma with the extension).

Maybe Youtube somehow bypasses Firefox facilities / API trough some other way to "sniff" media key presses? I'm not actually sure I've had this elsewhere than Youtube, but I'm fairly certain I have (however, even if this is only affected buy Youtube, it is still a major PITA, since that is the media site I use 98% of the time I use any media site...)

Thanks!

Offline

#6 2020-06-27 15:16:39

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

While not directly related to media keys, disabling autoplay may mitigate the issue a bit.

Preferences > privacy & security > permissions  > autoplay settings .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2020-06-28 18:34:15

Wild Penguin
Member
Registered: 2015-03-19
Posts: 319

Re: [SOLVED]Prevent Firefox from hijacking media keys (KDE Plasma)

Ok, the problem was the "Plasma Integration" plugin. I didn't know to blame it since one could guess such a plugin would reduce, not introduce this kind of problems.

It does offer integration into the "Media Player" plasmoid, however the dialog to choose the player is just broken (despite choosing "Clementine" or whatever, Firefox gets the keypresses). It is either a bug in the plasmoid or, less likely, in the plugin, since I think the plasmoid should always be in charge.

Marking as "SOLVED" (in the sence the cause and workaround has been found; just disable the plugin or it's media control setting).

Offline

Board footer

Powered by FluxBB