joshgoebel / keyszer

a smart, flexible keymapper for X11 (a fork/reboot of xkeysnail )
Other
69 stars 15 forks source link

(enh) Implement throttle delays on keystrokes #135

Closed RedBearAK closed 1 year ago

RedBearAK commented 1 year ago

As noted in the Wayland support thread, and previously noted in another thread, there are severe problems in some situations with keystroke timing, particularly the interpreted timing of modifier keystrokes. In fact, prior to the addition of throttles, keyszer was basically unusable even for common shortcut combos in the virtual machine where I'm testing Wayland support.

Through many different iterations of testing, I found a location in send_combo that allows the output to be throttled effectively, solving the problem while minimally affecting shortcut combos and normal typing. All features of my highly customized Kinto config file are now working in Wayland+GNOME inside the previously mentioned virtual machine.

The proposed solution to give the user the ability to insert optional sleep delays, in a couple of different spots that have been found highly effective, is submitted as PR #134.

Usage example (in the user's config file):

throttle_delays(
    unicode_delay_ms = 0,          # default: 0 ms, range: 0 to 100 ms, suggested: 10 ms
    keystroke_delay_ms = 50,        # default: 0 ms, range: 0 to 150 ms, suggested: 1-50 ms
)

This is somewhat modeled off of the timeouts() function, that allows tuning of the multipurpose and suspend timeouts. Although the back end is simpler, with one of the sleep delays being pushed into output.py from config_api.py at startup.

timeouts(
    multipurpose = 1,           # default: 1 sec
    suspend = 0,                # default: 1 sec
)
RedBearAK commented 1 year ago

Satisfied by the merge of #134