RedBearAK / toshy

Keymapper config to make Linux work like a 'Tosh!
https://toshy.app
GNU General Public License v3.0
226 stars 15 forks source link

[BUG] Shift key is delayed by ~2 seconds in Helldivers 2 #300

Closed elistevens closed 1 week ago

elistevens commented 1 week ago
``` Bare metal or virtual machine: Bare metal (If in VM, which VM software): None (Try running 'toshy-env' in a terminal to fill out the following fields...) (EV) Toshy env module sees this environment: DISTRO_ID = 'ubuntu' DISTRO_VER = '22.04' VARIANT_ID = 'notfound' SESSION_TYPE = 'x11' DESKTOP_ENV = 'gnome' DE_MAJ_VER = '42' Keyboard type (IBM, Chromebook, Windows, Apple): UHK https://ultimatehackingkeyboard.com/ with the key cluster and trackpad modules. Keyboard device name (try 'toshy-devices'): $ toshy-devices List of devices seen by the keymapper (xwaykeyz or keyszer): xwaykeyz v1.1.0 --------------------------------------------------------------------------------------- Device Name Phys --------------------------------------------------------------------------------------- /dev/input/event0 Power Button PNP0C0C/button/input0 /dev/input/event1 Power Button LNXPWRBN/button/input0 /dev/input/event2 Video Bus LNXVIDEO/video/input0 /dev/input/event10 Eee PC WMI hotkeys eeepc-wmi/input0 /dev/input/event11 Asus WMI hotkeys asus-nb-wmi/input0 /dev/input/event12 HDA NVidia HDMI/DP,pcm=3 ALSA /dev/input/event13 HDA NVidia HDMI/DP,pcm=7 ALSA /dev/input/event14 HDA NVidia HDMI/DP,pcm=8 ALSA /dev/input/event15 HDA NVidia HDMI/DP,pcm=9 ALSA /dev/input/event16 HD-Audio Generic HDMI/DP,pcm=3 ALSA /dev/input/event17 HD-Audio Generic HDMI/DP,pcm=7 ALSA /dev/input/event18 3D Camera: eTronVideo usb-0000:0d:00.4-2.4.1/button /dev/input/event3 Logitech Gaming Mouse G502 usb-0000:0d:00.4-1.1/input0 /dev/input/event4 Logitech Gaming Mouse G502 Keyboard usb-0000:0d:00.4-1.1/input1 /dev/input/event5 Ultimate Gadget Laboratories UHK 60 v1 usb-0000:0d:00.4-1.2/input1 /dev/input/event6 Ultimate Gadget Laboratories UHK 60 v1 usb-0000:0d:00.4-1.2/input2 /dev/input/event7 Ultimate Gadget Laboratories UHK 60 v1 usb-0000:0d:00.4-1.2/input3 /dev/input/event8 Ultimate Gadget Laboratories UHK 60 v1 usb-0000:0d:00.4-1.2/input4 /dev/input/event9 Creative Technology Ltd Sound Blaster Play! 3 Consumer Control usb-0000:0d:00.4-1.4/input3 ``` * * * Problem observed: I play Helldivers 2 in windowed fullscreen, and have shift mapped to the "run" key. When I press shift while toshy is enabled, there is a noticeable delay between the keypress and the running animation starting. If I quit HD2, stop the toshy script and services via the menu, and restart the game, the shift key/run animation behaves normally. Please let me know if additional debugging info would be useful.
RedBearAK commented 1 week ago

@elistevens

The delay is exactly one second actually. We all underestimate how long one second is. It’s controlled by the “suspend” timeout setting in the config file.

See here:

https://github.com/RedBearAK/toshy/wiki/FAQ-(Frequently-Asked-Questions)#modclicking-blocked-by-keymapper-suspend-timeout

And then the FAQ entry after that may become relevant if you set the suspend timeout to 0.1 seconds.

elistevens commented 1 week ago

"Being chased by monsters" time dilation is real. Thanks for the quick response!

Setting the suspend timeout to zero solved the issue.

Random musing: would it be possible to limit the suspend timeout to only keys that are known to cause issues? Or perhaps only to apps that are known to behave poorly?

Also, FYI, the UHK keyboard I use has modifier keys in the lower left labeled ctrl, super, alt, fn, space (originally mod, but I remapped that), and when the keyboard is plugged into my MBP it uses super+c for copy, etc. I had to specifically select keyboard type>apple to have the same behavior with toshy. Works great now! Not sure if that's worth a FAQ or not.

RedBearAK commented 1 week ago

@elistevens

The keyboard type generally only needs to be fixed with a non-Apple keyboard that has modifier positions like an Apple keyboard. This FAQ entry and the one above it is probably the best I can do for that issue.

https://github.com/RedBearAK/toshy/wiki/FAQ-(Frequently-Asked-Questions)#my-keyboard-is-a-switchable-windowsmac-universal-model

Random musing: would it be possible to limit the suspend timeout to only keys that are known to cause issues? Or perhaps only to apps that are known to behave poorly?

The suspend/resume logic is complicated and I didn’t write it. Such modifications may be possible, but it’s difficult to change the logic without messing it up in some way. I always have to disable it anyway due to using a trackpad, which won’t let me move the mouse cursor if I tell the keymapper to grab the trackpad device.

Maybe someday it can be refined a bit.

A more pressing issue is how to get the keymapper to work better with non-US keyboard layouts.

Thanks for the generous support.