Reply to topic

Why can I not disable plasma browser integration?

Daphazard
Registered Member
Posts
18
Karma
0
OS
This is truly baffling me.

I want to remove the entire feature where videos playing in a browser can be controlled with media keys.
From my understanding, this is driven by two components:
  • The plasma-browser-integration package
  • A browser add-on for each browser that is to use the feature

I have removed the package from my system. APT shows it as not installed. I've also removed the extension from both browsers I use (Vivaldi and Firefox). Yet, the integration feature still works with both of them! Pressing the Play/Pause key on my keyboard pauses youtube videos (or any other in-browser video), and the "media player" icon on the system tray shows the title of the playing video.

How can the feature work when none of its components are installed? What can I do to stop it entirely?
koffeinfriedhof
Registered Member
Posts
262
Karma
2
OS
Hi!
First thing: both of your browsers are GTK-Browsers that are not Qt-based and do not follow KDE/Qt-Standards.
The media keys do have a special signal/symbol they trigger: XF86{type} (like XF86Mail, XF86AudioPlay, …). You have to (re-)map these keys / disable them.
For software from the KDE-Community, you can edit this using `kcmshell5 kcm_keys`. If this does not change the behaviour of your browsers, you can override these signals using an ~/.Xmodmap-file. See e.g. ArchWiki: Xmodmap for a detailed explanation.
Daphazard
Registered Member
Posts
18
Karma
0
OS
Hi, thanks for the reply.

Are you saying then that the effects I'm noticing are not because of browser integration, but the browsers are doing this on their own? I'm pretty sure it didn't use to happen at all before KDE released the integration module.

Remapping the keys wouldn't help anyway. I still want them to work with independent apps, like VLC or Elise or anything that is not running on a website.

In particular, I want all of the below to stop happening:

- Media keys affecting video in browser (but keep them affecting media in apps)
- The "Media Player" icon in the systray displaying what's playing in my browser (but still work with media apps)
- KDE Connect on my phone showing controls for a video playing in a browser on my PC (but still show media controls for media apps on the PC)

and so on. I don't want to disable media functionality in KDE Plasma, only when it comes to browsers. I thought that's exactly what browser integration did, and as far as I can remember this is exactly how it used to work before integration was made possible.
koffeinfriedhof
Registered Member
Posts
262
Karma
2
OS
Daphazard wrote:…but the browsers are doing this on their own?…

Yes. For firefox you can enter the 'about:config'-tab and disable «media.hardwaremediakeys.enabled». This is integrated in firefox itself. I don't really know what this browser integration does, but I think it is more to display the controls, metadata and so on.

Keyboard handling is a bit special, I try to explain it in short: If you press a key, there are multiple informations send to the system, (5 values per event), which are written to /dev/input/event{number}, where number is dynamically created via udev on boot. Same on releasing a key.
These event-structures are mapped by the «input handler» to allow different usages and layouts. Thats what you know from localisation, e.g. `loadkeys fr` in terminal; `setxkbmap us altgr-intl pc105` would load the us layout with some key definitions and map it to a european default keyboard with 105 keys using xkb (from X, but wayland uses xkb too).
Next is the desktop environment of Plasma/GNOME, catching these events and applying the shortcuts, etc.
If you press a key that is no shortcut or similar, the window manager passes it to the applications key event loop and the application triggers the function for this event. So if I do press 'e' it sends this character to the browser which will display the letter 'e' in the current answering box.
The mediakeys are handled differently. I only know the MPRIS stuff via DBus. If you start up VLC for example, it registers itself as «org.mpris.MediaPlayer2.vlc» on DBus which allows to control it via dbus. To quit vlc you could invoke the command `qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Quit`.
Pressing a multimediakey will send this key event to the current active window if it is registered. If not, the system passes the keypress-event to the next valid application handling those keys. (I'm not sure how it really works, but there is a (non KDE) Python based example on Alexays Waybar which is a minor example how to work with these mpris-stuff-players.

So to achieve what you asked for:
- Media keys affecting video in browser (but keep them affecting media in apps)

See above. Disable multimedia keys in firefox directly (no idea if this works in Vivaldi too)
- The "Media Player" icon in the systray displaying what's playing in my browser (but still work with media apps)

No idea how to handle this without rewriting/editing the source code and compiling a custom tray.
- KDE Connect on my phone showing controls for a video playing in a browser on my PC (but still show media controls for media apps on the PC)

I think this will not work if you disable these controls. Perhaps use different profiles/browsers?

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], joebuckley, Moldmaker, Sogou [Bot]