MangoHud
MangoHud copied to clipboard
Keybinds do not work on Wayland
Hi folks, could i ask that description for shortcuts is updated to say this is not supported on wayland? I am a dummy and tried for some hours now to fix this perceived issue not realizing it is not implemented yet :D.
I second fixing this, as Wayland is the future of desktop Linux, not X11.
+1 Please, fix keybinding in Wayland. Thanks!!!
So far I'm unaware of a way to achieve this in Wayland. It almost seems to me like it's not doable by design
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/73 https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/56 Maybe related.
@flightlessmango not sure if this could be done in mangohud but a lot of apps that require hotkeys to use the app, such as ulauncher (to toggle to launcher) and nyrna(to toggle whether an application is suspended or not) use a terminal command to achieve the desired toggable effect and then ask the user to map that command to a keyboard shortcut with the DE shortcutmanager
for example ulauncher added the ulauncher-toggle
and then i just add a keyboard shortcut for that in kde
What a PITA but you can test drive with native wayland vulkan apps: https://github.com/flightlessmango/MangoHud/tree/focus_loss
@zany130 probably a simpler way indeed
I was able to get around this with this script
File: Scripts/toggleMangoHud.sh
#!/bin/bash
config_file=~/.config/MangoHud/MangoHud.conf
no_disp=$(grep -i 'no_display=' "$config_file" | awk '{ print $3 }')
if grep -q "no_display=0" "$config_file"; then
sed -i 's/no_display=0/no_display=1/' "$config_file"
notify-send "MangoHud was turned Off"
elif grep -q "no_display=1" "$config_file"; then
sed -i 's/no_display=1/no_display=0/' "$config_file"
notify-send "MangoHud was turned On"
else
notify-send "ERROR value not found"
fi
and then adding it to kde shortcut settings
Git master can also use python script for some basic control in https://github.com/flightlessmango/MangoHud/tree/master/control if you enable abstract socket with control = mangohud
or per-process control = mangohud-%p
and specify socket with e.g. -s mangohud-$(pidof vkcube)
There is a way to achieve this under Wayland, it would work basically identically to the wayland keylogger project. The other option is the global shortcuts portal, but we don't need it to be global.
Via jadahl:
create a .so file that has wl_display_connect() exported. in there, dlopen libwayland-client.so and find the correct wl_display_connect address. when you get called, call the "real" function, but store away a proxy wrapper of the return value. get your own registry, find the seat, get a wl_keyboard and start listening to events.
And a bit of a warning, if relevant, from Arnavion:
Note that the LD_PRELOAD'ing to hook libwayland-client functions only works for processes that use libwayland-client Worst case you'll have to hook connect()
This has been attempted before, might be worth to look at for reference https://github.com/flightlessmango/MangoHud/commit/26c8d1dbdda16ae3af53c3aa7a71eaeb3ffd4acd
very initial version ready: https://github.com/flightlessmango/MangoHud/pull/1093
merged :)