Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard shortcuts don't work on Wayland #5257

Open
Krzmbrzl opened this issue Sep 7, 2021 · 31 comments · May be fixed by #5976
Open

Keyboard shortcuts don't work on Wayland #5257

Krzmbrzl opened this issue Sep 7, 2021 · 31 comments · May be fixed by #5976
Labels
bug A bug (error) in the software client GlobalShortcuts linux

Comments

@Krzmbrzl
Copy link
Member

Krzmbrzl commented Sep 7, 2021

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

@davidebeatrici
Copy link
Member

#3269

Krzmbrzl added a commit to Krzmbrzl/mumble that referenced this issue Nov 10, 2021
Our global shortcut system currently doesn't work when using Wayland
(mumble-voip#5257). Therefore, this
commit makes sure that the global shortcut system is not even started
on such systems. Furthermore, it informs the user about the shortcuts
being disabled.

Fixes mumble-voip#5303
Krzmbrzl added a commit to Krzmbrzl/mumble that referenced this issue Nov 10, 2021
Our global shortcut system currently doesn't work when using Wayland
(mumble-voip#5257). Therefore, this
commit makes sure that the global shortcut system is not even started
on such systems. Furthermore, it informs the user about the shortcuts
being disabled.

Fixes mumble-voip#5303
Krzmbrzl added a commit that referenced this issue Nov 11, 2021
Our global shortcut system currently doesn't work when using Wayland
(#5257). Therefore, this
commit makes sure that the global shortcut system is not even started
on such systems. Furthermore, it informs the user about the shortcuts
being disabled.
Krzmbrzl added a commit to Krzmbrzl/mumble that referenced this issue Nov 11, 2021
Our global shortcut system currently doesn't work when using Wayland
(mumble-voip#5257). Therefore, this
commit makes sure that the global shortcut system is not even started
on such systems. Furthermore, it informs the user about the shortcuts
being disabled.

Fixes mumble-voip#5303
Krzmbrzl added a commit to Krzmbrzl/mumble that referenced this issue Nov 18, 2021
Our global shortcut system currently doesn't work when using Wayland
(mumble-voip#5257). Therefore, this
commit makes sure that the global shortcut system is not even started
on such systems. Furthermore, it informs the user about the shortcuts
being disabled.

Fixes mumble-voip#5303
@icher
Copy link

icher commented Jan 22, 2022

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?

@Krzmbrzl
Copy link
Member Author

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

@trthomps
Copy link

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.

@zephrax
Copy link

zephrax commented Feb 8, 2022

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.

@Nothankslads
Copy link

Has there been any progress on this?

@Krzmbrzl
Copy link
Member Author

No

@jsparber
Copy link

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

@icher
Copy link

icher commented May 21, 2022

@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.

@bovinespongiformflu
Copy link

bovinespongiformflu commented May 21, 2022

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

@tidux
Copy link

tidux commented Oct 15, 2022

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.

@travismorton
Copy link

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.

@carlocastoldi
Copy link
Contributor

carlocastoldi commented Nov 9, 2022

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?

@travismorton
Copy link

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?

@carlocastoldi
Copy link
Contributor

carlocastoldi commented Nov 10, 2022

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

@ananace
Copy link

ananace commented Nov 20, 2022

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.

aleixpol added a commit to aleixpol/mumble that referenced this issue Nov 25, 2022
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
aleixpol added a commit to aleixpol/mumble that referenced this issue Nov 25, 2022
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
aleixpol added a commit to aleixpol/mumble that referenced this issue Nov 25, 2022
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
aleixpol added a commit to aleixpol/mumble that referenced this issue Nov 28, 2022
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
aleixpol added a commit to aleixpol/mumble that referenced this issue Jan 2, 2023
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
aleixpol added a commit to aleixpol/mumble that referenced this issue Jan 2, 2023
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
aleixpol added a commit to aleixpol/mumble that referenced this issue Jan 2, 2023
This makes it possible to have global shortcuts on systems running the
XDG Desktop Portal service. This is especially relevant on Wayland where
we are not able to run a system-wide keylogger to get the global
shortcuts triggers.

Fixes mumble-voip#5257
@RichardFevrier
Copy link

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

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Oct 6, 2023

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.

@RichardFevrier
Copy link

RichardFevrier commented Oct 6, 2023

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?

@Krzmbrzl
Copy link
Member Author

Krzmbrzl commented Oct 6, 2023

Ah 💡
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.

@RichardFevrier
Copy link

RichardFevrier commented Oct 6, 2023

Maybe @aleixpol would know 🙂

@aleixpol
Copy link

aleixpol commented Oct 8, 2023

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

@jp-bennett
Copy link

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.

@CmdrMoozy
Copy link

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

@Mikilio
Copy link

Mikilio commented Mar 26, 2024

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.

danpawlik added a commit to danpawlik/dotfiles that referenced this issue Apr 26, 2024
The KDE community added an option: "Legacy X11 App Support", which
was very important to me to avoid hacks to run push-to-talk in Mumble [1].
That feature works. Thank you KDE [2]

[1] mumble-voip/mumble#5257 (comment)
[2] https://invent.kde.org/plasma/kwin/-/merge_requests/4595
@Ases
Copy link

Ases commented Jun 18, 2024

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

I confirm that the Push To Talk with a mouse button is now functional under KDE Plasma 6.1 configuring the Legacy X11 App Support. 🎉

@BadCo-NZ
Copy link

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

I confirm that the Push To Talk with a mouse button is now functional under KDE Plasma 6.1 configuring the Legacy X11 App Support. 🎉

How did you do this? Mumble flatpak crashes for me on Fedora Kinoite when I enable Global Shortcuts.

@Ases
Copy link

Ases commented Jun 21, 2024

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

I confirm that the Push To Talk with a mouse button is now functional under KDE Plasma 6.1 configuring the Legacy X11 App Support. 🎉

How did you do this? Mumble flatpak crashes for me on Fedora Kinoite when I enable Global Shortcuts.

I'm currently using Mumble v1.5.517 from snapcrafters on KDE neon.
Although I'm not a fan of snaps and generally avoid them, I wanted
to try it.
I then simply configured "Legacy X11 App Support" without any special adjustments.

@trthomps
Copy link

I can also confirm it's been working for a while on Arch Linux with the system packages.

@aleixpol
Copy link

Please don't consider the issue as addressed with the "Legacy X11 app support". Because it's only for X11 and effectively a backwards-compatibility workaround, not the right way to support it on Wayland.
#5976

@dotbanana

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug (error) in the software client GlobalShortcuts linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.