mumble icon indicating copy to clipboard operation
mumble copied to clipboard

Keyboard shortcuts don't work on Wayland

Open Krzmbrzl opened this issue 3 years ago • 31 comments

Describe the bug When using Wayland instead of X11, the global shortcut engine does not work and as a consequence none of the user-registered shortcuts function.

Steps to Reproduce Steps to reproduce the behavior:

  1. Use Wayland
  2. Try to use or register a shortcut

Expected behavior Shortcuts to work normally

Desktop (please complete the following information):

  • OS: Linux (Wayland)
  • Version: all

Additional context To my knowledge to this date Wayland (in contrast to X11) does not provide a way to either grab all user input nor does it allow to register global shortcuts. Instead one is supposed to register shortcuts with the currently used Window Manager (but there does not seem to exist a standard to do this).

Related issues: #3816 #3243 #4073 #5303

Krzmbrzl avatar Sep 07 '21 15:09 Krzmbrzl

#3269

davidebeatrici avatar Sep 07 '21 17:09 davidebeatrici

Well, when I used 1.3.4 I can define hotkey for Push-to-talk and use it when Mumble window is focused. You can't use it in games whatever, but it's worked when you just want to talk. In 1.4 I can't do that. What should I do to use Push-to-talk when Mumble window is active at least?

icher avatar Jan 22 '22 13:01 icher

ATM there is no way around it. But there is already a ticket about weakening the disabling of shortcuts on Wayland.

Krzmbrzl avatar Jan 22 '22 18:01 Krzmbrzl

I was using PTT successfully in 1.3.4 as long as my mouse had focus on an X app (i.e. most games right now). Would be nice to restore that behavior until global shortcuts are fixed in Wayland.

trthomps avatar Jan 28 '22 05:01 trthomps

Same here. It was working before, but with one of the last upgrades it seems that the functionality was disabled on purpose. I was able to use it successfully while focusing on a X Window.

zephrax avatar Feb 08 '22 11:02 zephrax

Has there been any progress on this?

Nothankslads avatar Apr 19 '22 23:04 Nothankslads

No

Krzmbrzl avatar Apr 20 '22 05:04 Krzmbrzl

What should I do to use Push-to-talk when Mumble window is active at least?

@icher You can enable "Display push to talk window" to get a extra window with a button. It's not great but better then nothing.

image

jsparber avatar May 17 '22 15:05 jsparber

@icher You can enable "Display push to talk window" to get a extra window with a button. It's not great but better then nothing.

Nah, it's not usable. I just downgrade to 1.3.4 and run as QT_QPA_PLATFORM=xcb mumble.

icher avatar May 21 '22 06:05 icher

Please restore old functionality, having it disabled entirely isnt helping anyone and it still worked fine in proton/x games. edit: https://github.com/mumble-voip/mumble/pull/5688 i see there is already a plan to restore functionality. do we know when this will be merged?

bovinespongiformflu avatar May 21 '22 21:05 bovinespongiformflu

A workaround is to use the RPC client to map keys to commands in your WM/DE, although you do need to dedicate two keybinds for it:

mumble rpc starttalking and mumble rpc stoptalking do what you'd expect for PTT.

tidux avatar Oct 15 '22 22:10 tidux

I've been running a hacky workaround using the mumble D-Bus API and libinput. As long as your user is part of the input group you can listen for mouse/keyboard down/up events and forward them to the startTalking and stopTalking D-Bus methods. Here's the script I run in the background. It will enable PTT when BTN_EXTRA is pushed.

Before this I was using Sway's bindsym to emit the D-Bus calls similar to what @tidux suggested, but events would get dropped based on where the mouse was. Going directly to libinput helped me avoid the dropped button-up events which caused state issues and an always-on mic sometimes. It also doesn't depend on focus being on an X window for PTT to work.

travismorton avatar Nov 09 '22 06:11 travismorton

i love your script, @travismorton. Thanks a lot!

I think it removes the security of Wayland from possible keyloggers, but it's a price i'm ready to pay. Even more as I expect it to be a temporary solution. At least until a shortcuts xdg-portal is not finalized.

P.S. do you have a way to pin a particular /dev/input/event* to the same path?

carlocastoldi avatar Nov 09 '22 22:11 carlocastoldi

Good point, I should have mentioned the possible security hole in adding your user to the input group. There's more nuanced ways to do that which involve udev rules and logind as mentioned in this reddit thread, although they don't completely solve the issue, just limit the blast radius.

After you mentioned pinning the event path I changed the script to fetch the context based on libinput seat rather than path. Assuming your DE/WM doesn't create multiple seats this should always be seat0 (as far as my limited understanding goes) and shouldn't change. The gist is updated as well, hopefully that accomplishes what you're looking for?

travismorton avatar Nov 10 '22 02:11 travismorton

here's more nuanced ways to do that which involve udev rules and logind as mentioned in this reddit thread

I was indeed wondering if we couldn't do some udev rule magic!

although they don't completely solve the issue, just limit the blast radius

it limits the "keylogging capabilities" to the device you want to bind PTT to, right? Or is the blast radius wider?

The gist is updated as well, hopefully that accomplishes what you're looking for?

It does! It's awesome, thanks!

P.S.: for anyone on Arch (or derivates), here is the PKGBUILD for python-libinput

carlocastoldi avatar Nov 10 '22 09:11 carlocastoldi

There is the XDG global shortcut portal API (PR, Docs) which should also allow for binding global shortcuts on Wayland in a DE-agnostic way - though with a bit of DBus work, unfortunately it's not actually available in any released version of KDE/GNOME yet, so it'll probably be a while until it can be used.

ananace avatar Nov 20 '22 10:11 ananace

Will it be possible to use only one key to bind the Push To Talk functionality?

RichardFevrier avatar Oct 06 '23 13:10 RichardFevrier

I'm not sure if I understand your question correctly, but binding a single key requires the same infrastructure as binding multiples - Aka: it currently doesn't work properly on Wayland as the current shortcut implementation relies on being notified of all input events (essentially a key logger), which is not possible on Wayland.

Krzmbrzl avatar Oct 06 '23 14:10 Krzmbrzl

I meant; will the xdg-desktop-portal GlobalShortcuts lets mumble users to use only a single key for the Push to Talk functionality when everything will be implemented?

RichardFevrier avatar Oct 06 '23 16:10 RichardFevrier

Ah :bulb: Yes I would expect so. The hope would be for this change to be completely transparent such that the user doesn't notice whether they are using Mumble with X11 or with Wayland.

Krzmbrzl avatar Oct 06 '23 17:10 Krzmbrzl

Maybe @aleixpol would know 🙂

RichardFevrier avatar Oct 06 '23 18:10 RichardFevrier

Yes, it's possible to use a single key for push to talk as does this PR, it's not something theoretical.

aleixpol avatar Oct 08 '23 00:10 aleixpol

KDE has added "Legacy X11 App Support" to the system settings when running under Wayland, and one of the options is to allow applications to read keystrokes again. This completely fixes push-to-talk support on Fedora. There is a merge request (https://invent.kde.org/plasma/kwin/-/merge_requests/4595) to extend this system to also send mouse button presses.

jp-bennett avatar Nov 05 '23 19:11 jp-bennett

Note that for now at least the "Legacy X11 App Support" only seems to work for keyboard shortcuts. For mouse button support, it appears KDE 6.1 will be needed: https://www.mail-archive.com/[email protected]/msg889735.html

CmdrMoozy avatar Mar 03 '24 04:03 CmdrMoozy

I use hyprland and in a very wayland like way I let the compositor handle global shortcuts for me by sending it to the mumble application. I believe that also in the future, global shortcuts should be handled by the compositor. Maybe we can ask freedesktop to make a standard configuration format for this. That way, mumble can suggest configurations that work independent of the compositor. This way there are no security compromises as the user will be conscious of all changes.

Mikilio avatar Mar 26 '24 11:03 Mikilio