xremap / xremap

Key remapper for X11 and Wayland
MIT License
1.43k stars 83 forks source link

Modifier Release Support (Wayland) #100

Closed petrstepanov closed 11 months ago

petrstepanov commented 2 years ago

Dear Takashi, I noticed unexpected behavior regarding the modifier key release. Below please find a minimal example of the issue. For instance, I would like the remapper to output a lowercase b when user presses Shift-a:

keymap:
  - name: Type lowercase `b` on Shift-a keypress
    remap:
      Shift-a: b

Currently when I run the above configuration file and press Shift-a in a text editor, the uppercase B is output. This is due to the fact that Shift modifier is "not released" and affects the output of a lowercase character b modifying it into a capitalized B.

Is there any plan to implement a release functionality. Off the top of my head, the config file could be extended as follows:

keymap:
  - name: Type lowercase `b` on Shift-a keypress
    remap:
      Shift-a: [{ release: Shift }, b]

Maybe one can come up with a more elegant syntax depending on the implementation. We have to take into account that sometimes there are two modifier keys (Shift-Control-KEY...) and both of them may need to be released. Let me know if this makes sense. Looking forward to hearing from you!

P.S. This functionality with modifier keys releasing is addressed in Key Mapper.

petrstepanov commented 2 years ago

To clarify. I tested this behavior on Fedora 36 with Wayland.

k0kubun commented 2 years ago

I cannot reproduce your issue. It worked as you expected in my environment.

$ cat /tmp/a.yml
keymap:
  - name: Type lowercase `b` on Shift-a keypress
    remap:
      Shift-a: b

$ xremap --version
xremap 0.4.3

$ RUST_LOG=debug xremap /tmp/a.yml
Selecting devices from the following list:
------------------------------------------------------------------------------
/dev/input/event0 : Power Button
/dev/input/event1 : Power Button
/dev/input/event10: HDA NVidia HDMI/DP,pcm=9
/dev/input/event11: HDA NVidia HDMI/DP,pcm=10
/dev/input/event12: HDA NVidia HDMI/DP,pcm=11
/dev/input/event13: HDA NVidia HDMI/DP,pcm=12
/dev/input/event14: HD-Audio Generic Front Mic
/dev/input/event15: HD-Audio Generic Rear Mic
/dev/input/event16: HD-Audio Generic Line
/dev/input/event17: HD-Audio Generic Line Out Front
/dev/input/event18: HD-Audio Generic Line Out Surround
/dev/input/event19: HD-Audio Generic Line Out CLFE
/dev/input/event2 : Logitech B330/M330/M3
/dev/input/event20: HD-Audio Generic Front Headphone
/dev/input/event3 : Apple, Inc. USB-C to 3.5mm Headphone Jack Adapter
/dev/input/event4 : PFU Limited HHKB-Hybrid
/dev/input/event5 : PFU Limited HHKB-Hybrid Consumer Control
/dev/input/event6 : PFU Limited HHKB-Hybrid Keyboard
/dev/input/event7 : HDA NVidia HDMI/DP,pcm=3
/dev/input/event8 : HDA NVidia HDMI/DP,pcm=7
/dev/input/event9 : HDA NVidia HDMI/DP,pcm=8
------------------------------------------------------------------------------
Selected keyboards automatically since --device options weren't specified:
------------------------------------------------------------------------------
/dev/input/event4 : PFU Limited HHKB-Hybrid
/dev/input/event6 : PFU Limited HHKB-Hybrid Keyboard
------------------------------------------------------------------------------
[2022-05-25T04:42:06Z DEBUG xremap::event_handler] => 0: KEY_ENTER
[2022-05-25T04:42:06Z DEBUG xremap::event_handler] 0: KEY_ENTER
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] => 1: KEY_LEFTSHIFT
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 1: KEY_LEFTSHIFT
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] => 1: KEY_A
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 0: KEY_LEFTSHIFT
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 1: KEY_B
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 0: KEY_B
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 1: KEY_LEFTSHIFT
b[2022-05-25T04:42:08Z DEBUG xremap::event_handler] => 0: KEY_A
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 0: KEY_A
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] => 0: KEY_LEFTSHIFT
[2022-05-25T04:42:08Z DEBUG xremap::event_handler] 0: KEY_LEFTSHIFT

Can you show logs in the same format as above? In other words, I want you to run RUST_LOG=debug xremap, press Shift-a, and paste the entire output of xremap during these operations.

petrstepanov commented 2 years ago

Hi @k0kubun, please find my Terminal output below:

[petrstepanov@fedora ~]$ cat /usr/local/share/gnome-macos-remap/config.yml 
keymap:
  - name: Type lowercase `b` on Shift-a keypress
    remap:
      Shift-a: b
[petrstepanov@fedora ~]$ xremap --version
xremap 0.4.3
[petrstepanov@fedora ~]$ sudo RUST_LOG=debug xremap /usr/local/share/gnome-macos-remap/config.yml 
[sudo] password for petrstepanov: 
Selecting devices from the following list:
------------------------------------------------------------------------------
/dev/input/event0 : Lid Switch
/dev/input/event1 : Power Button
/dev/input/event10: HDA Intel PCH Headphone
/dev/input/event11: HDA Intel HDMI HDMI/DP,pcm=3
/dev/input/event12: HDA Intel HDMI HDMI/DP,pcm=7
/dev/input/event13: HDA Intel HDMI HDMI/DP,pcm=8
/dev/input/event14: HDA Intel HDMI HDMI/DP,pcm=9
/dev/input/event15: HDA Intel HDMI HDMI/DP,pcm=10
/dev/input/event2 : Sleep Button
/dev/input/event3 : Power Button
/dev/input/event4 : xremap pid=4010
/dev/input/event5 : Apple Inc. Apple Internal Keyboard / Trackpad
/dev/input/event7 : Video Bus
/dev/input/event8 : bcm5974
/dev/input/event9 : PC Speaker
------------------------------------------------------------------------------
Selected keyboards automatically since --device options weren't specified:
------------------------------------------------------------------------------
/dev/input/event5 : Apple Inc. Apple Internal Keyboard / Trackpad
------------------------------------------------------------------------------
[2022-05-25T18:24:34Z DEBUG xremap::event_handler] => 0: KEY_ENTER
[2022-05-25T18:24:34Z DEBUG xremap::event_handler] 0: KEY_ENTER
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] => 1: KEY_LEFTSHIFT
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 1: KEY_LEFTSHIFT
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] => 1: KEY_A
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 0: KEY_LEFTSHIFT
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 1: KEY_B
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 0: KEY_B
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 1: KEY_LEFTSHIFT
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] => 0: KEY_A
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 0: KEY_A
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] => 0: KEY_LEFTSHIFT
[2022-05-25T18:24:39Z DEBUG xremap::event_handler] 0: KEY_LEFTSHIFT

It seems to be identical to yours. I would like to stress that I'm testing on Fedora 36, GNOME 42.1 on Wayland. Running xremap as sudo. Below please find a screencast link demonstrating the issue:

https://user-images.githubusercontent.com/859814/170340023-abd84a5d-0040-489b-8367-736c2908f7bd.mp4

petrstepanov commented 2 years ago

Interesting enough, I just tested Xorg and the issue is not present there. Seems that only Wayland is affected. Can you please confirm you tested Wayland environment?

k0kubun commented 2 years ago

As you can see from the logs in your screencast, xremap correctly outputs a release event of Shift before generating a press event of B. Also, I tested the same thing with GNOME on Wayland on Ubuntu 22.04, and it worked fine. So it doesn't seem Wayland-specific either. I'm afraid this is specific to something in your environment that is not part of xremap or GNOME on Wayland.

Because no bug of xremap has been reported in this issue so far, let me close this for now. It doesn't mean that I won't read comments in this issue though.


I encourage you to test what happens when you have no remapping (e.g. remap: {}) and you manually reproduce the event sequence without the help of remapping. In other words, I want you to press Shift, release it, press B, and release it. When the event sequence logged on RUST_LOG=debug looks exactly the same as your screencast, theoretically, it will produce B on your environment. Then, it's not a problem of the remapper but something else that interferes with key events coming from uinput.

petrstepanov commented 2 years ago

Hi @k0kubun, I performed a clean install of Fedora 36 on my laptop and tested the scenario you proposed. Having the empty remap: {} in config file, everything works as expected:

Shift (press)+Shift (release)+b β†’ b

xremap output:

[2022-05-26T21:03:54Z DEBUG xremap::event_handler] => 1: KEY_LEFTSHIFT
[2022-05-26T21:03:54Z DEBUG xremap::event_handler] 1: KEY_LEFTSHIFT
[2022-05-26T21:03:55Z DEBUG xremap::event_handler] => 0: KEY_LEFTSHIFT
[2022-05-26T21:03:55Z DEBUG xremap::event_handler] 0: KEY_LEFTSHIFT
[2022-05-26T21:03:55Z DEBUG xremap::event_handler] => 1: KEY_B
[2022-05-26T21:03:55Z DEBUG xremap::event_handler] 1: KEY_B
[2022-05-26T21:03:55Z DEBUG xremap::event_handler] => 0: KEY_B
[2022-05-26T21:03:55Z DEBUG xremap::event_handler] 0: KEY_B

Shift (press)+b+Shift (release) β†’ B

xremap output:

[2022-05-26T21:04:07Z DEBUG xremap::event_handler] => 1: KEY_LEFTSHIFT
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] 1: KEY_LEFTSHIFT
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] => 1: KEY_B
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] 1: KEY_B
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] => 0: KEY_B
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] 0: KEY_B
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] => 0: KEY_LEFTSHIFT
[2022-05-26T21:04:07Z DEBUG xremap::event_handler] 0: KEY_LEFTSHIFT

Please refer to the screencast below:

https://user-images.githubusercontent.com/859814/170584099-a7ae48a9-e053-499b-bbd3-5f3118b8bee4.mp4

However, if I test again the xremap config with Shift+a β†’ b remap, I get capitalized B output. Therefore, I still think there may be an issue with the xremap.

Actually, I just realized one thing. Is there any chance you have Nvidia video drivers installed on your Ubuntu 22.04? To my knowledge, Ubuntu 22.04 falls back to Xorg only with Nvidia drivers. It will not run wayland.

Can you please confirm your echo $XDG_SESSION_TYPE terminal output on Ubuntu 22.04 is wayland? Looking forward to hearing from you!

k0kubun commented 2 years ago

I performed a clean install of Fedora 36 on my laptop and tested the scenario you proposed

Great idea πŸ™‚ I appreciate your effort.

Actually, I just realized one thing. Is there any chance you have Nvidia video drivers installed on your Ubuntu 22.04? To my knowledge, Ubuntu 22.04 falls back to Xorg only with Nvidia drivers. It will not run wayland.

I do use an Nvidia driver. Wayland isn't enabled by default, but I've tweaked a config to enable that in the past. So I can explicitly choose "GNOME on Wayland" instead of "GNOME" (Xorg) and the behavior I reported was tested with that mode.

Can you please confirm your echo $XDG_SESSION_TYPE terminal output on Ubuntu 22.04 is wayland?

Sure, here's the output of the requested echo and ps aufx in case you're curious. ``` $ echo $XDG_SESSION_TYPE wayland $ ps aufx USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2 0.0 0.0 0 0 ? S 14:44 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [rcu_gp] root 4 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [rcu_par_gp] root 5 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/0:0-rcu_par_gp] root 6 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/0:0H-events_highpri] root 7 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/0:1-rcu_par_gp] root 8 0.4 0.0 0 0 ? I 14:44 0:00 \_ [kworker/u64:0-flush-259:0] root 9 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [mm_percpu_wq] root 10 0.0 0.0 0 0 ? S 14:44 0:00 \_ [rcu_tasks_rude_] root 11 0.0 0.0 0 0 ? S 14:44 0:00 \_ [rcu_tasks_trace] root 12 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/0] root 13 0.0 0.0 0 0 ? I 14:44 0:00 \_ [rcu_sched] root 14 0.0 0.0 0 0 ? S 14:44 0:00 \_ [migration/0] root 15 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/0] root 16 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/0] root 17 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/1] root 18 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/1] root 19 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/1] root 20 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/1] root 21 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/1:0-rcu_par_gp] root 22 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/1:0H-kblockd] root 23 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/2] root 24 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/2] root 25 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/2] root 26 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/2] root 27 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/2:0-pm] root 28 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/2:0H-events_highpri] root 29 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/3] root 30 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/3] root 31 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/3] root 32 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/3] root 33 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/3:0-rcu_par_gp] root 34 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/3:0H-events_highpri] root 35 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/4] root 36 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/4] root 37 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/4] root 38 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/4] root 39 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/4:0-cgroup_destroy] root 40 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/4:0H-events_highpri] root 41 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/5] root 42 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/5] root 43 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/5] root 44 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/5] root 45 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/5:0-rcu_par_gp] root 46 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/5:0H-events_highpri] root 47 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/6] root 48 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/6] root 49 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/6] root 50 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/6] root 51 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/6:0-events] root 52 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/6:0H-kblockd] root 53 0.0 0.0 0 0 ? S 14:44 0:00 \_ [cpuhp/7] root 54 0.0 0.0 0 0 ? S 14:44 0:00 \_ [idle_inject/7] root 55 0.2 0.0 0 0 ? S 14:44 0:00 \_ [migration/7] root 56 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ksoftirqd/7] root 57 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/7:0-rcu_par_gp] root 58 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/7:0H-events_highpri] root 59 0.0 0.0 0 0 ? S 14:44 0:00 \_ [kdevtmpfs] root 60 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [netns] root 61 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [inet_frag_wq] root 62 0.0 0.0 0 0 ? S 14:44 0:00 \_ [kauditd] root 63 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/0:2-events] root 64 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/1:1-events] root 65 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/1:2-mm_percpu_wq] root 66 0.0 0.0 0 0 ? S 14:44 0:00 \_ [khungtaskd] root 67 0.0 0.0 0 0 ? S 14:44 0:00 \_ [oom_reaper] root 68 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [writeback] root 69 0.0 0.0 0 0 ? S 14:44 0:00 \_ [kcompactd0] root 70 0.0 0.0 0 0 ? SN 14:44 0:00 \_ [ksmd] root 71 0.0 0.0 0 0 ? SN 14:44 0:00 \_ [khugepaged] root 81 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/6:1-cgroup_destroy] root 84 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/7:1-events] root 119 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kintegrityd] root 120 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kblockd] root 121 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [blkcg_punt_bio] root 122 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [tpm_dev_wq] root 123 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [ata_sff] root 124 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [md] root 125 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [edac-poller] root 126 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [devfreq_wq] root 127 0.0 0.0 0 0 ? S 14:44 0:00 \_ [watchdogd] root 128 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/u64:1-flush-259:0] root 129 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kworker/0:1H-kblockd] root 130 0.0 0.0 0 0 ? S 14:44 0:00 \_ [irq/25-AMD-Vi] root 132 0.0 0.0 0 0 ? S 14:44 0:00 \_ [kswapd0] root 133 0.0 0.0 0 0 ? S 14:44 0:00 \_ [ecryptfs-kthrea] root 135 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/2:1-events] root 136 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [kthrotld] root 137 0.0 0.0 0 0 ? S 14:44 0:00 \_ [irq/26-aerdrv] root 138 0.0 0.0 0 0 ? S 14:44 0:00 \_ [irq/27-aerdrv] root 139 0.0 0.0 0 0 ? S 14:44 0:00 \_ [irq/28-aerdrv] root 140 0.0 0.0 0 0 ? S 14:44 0:00 \_ [irq/30-aerdrv] root 141 0.0 0.0 0 0 ? S 14:44 0:00 \_ [irq/31-aerdrv] root 142 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/3:1-cgroup_destroy] root 143 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/4:1-cgwb_release] root 144 0.0 0.0 0 0 ? I 14:44 0:00 \_ [kworker/5:1-cgroup_destroy] root 145 0.0 0.0 0 0 ? I< 14:44 0:00 \_ [acpi_thermal_pm] root 146 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [vfio-irqfd-clea] root 147 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [mld] root 148 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [ipv6_addrconf] root 157 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kstrp] root 160 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [zswap-shrink] root 161 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/2:2-cgroup_destroy] root 162 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/3:2-mm_percpu_wq] root 163 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/4:2-events] root 164 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/5:2-events] root 165 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/6:2-events] root 166 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/7:2-cgroup_destroy] root 167 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/u65:0-xprtiod] root 174 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [charger_manager] root 175 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/0:3-rcu_par_gp] root 197 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/4:1H-kblockd] root 223 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/3:1H-kblockd] root 224 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [nvme-wq] root 225 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [nvme-reset-wq] root 226 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [nvme-delete-wq] root 227 0.0 0.0 0 0 ? S 14:45 0:00 \_ [scsi_eh_0] root 228 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [scsi_tmf_0] root 229 0.0 0.0 0 0 ? S 14:45 0:00 \_ [scsi_eh_1] root 230 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [scsi_tmf_1] root 231 0.0 0.0 0 0 ? S 14:45 0:00 \_ [scsi_eh_2] root 232 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [scsi_tmf_2] root 233 0.0 0.0 0 0 ? S 14:45 0:00 \_ [scsi_eh_3] root 234 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:2-events_unbound] root 235 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:3-events_unbound] root 236 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [scsi_tmf_3] root 237 0.0 0.0 0 0 ? S 14:45 0:00 \_ [scsi_eh_4] root 238 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [scsi_tmf_4] root 239 0.0 0.0 0 0 ? S 14:45 0:00 \_ [scsi_eh_5] root 240 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [scsi_tmf_5] root 241 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:4-ext4-rsv-conversion] root 242 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:5-flush-259:0] root 243 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:6-events_unbound] root 244 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:7-events_unbound] root 245 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:8-events_power_efficient] root 246 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:9-events_power_efficient] root 249 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/7:1H-kblockd] root 250 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/5:1H-kblockd] root 252 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:10-events_unbound] root 253 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/u64:11] root 254 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/1:1H-kblockd] root 255 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/2:3-events] root 256 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/6:1H-kblockd] root 268 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/2:1H-kblockd] root 281 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [raid5wq] root 317 0.0 0.0 0 0 ? S 14:45 0:00 \_ [jbd2/nvme0n1p2-] root 318 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [ext4-rsv-conver] root 396 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [rpciod] root 397 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [xprtiod] root 404 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [ipmi-msghandler] root 613 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/6:3] root 687 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [cryptd] root 753 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/1:3-events] root 780 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/7:3-events] root 787 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/1:4-pm] root 957 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nv_queue] root 961 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nv_queue] root 1096 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/3:3-events] root 1097 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/1:5-events] root 1142 0.4 0.0 0 0 ? S 14:45 0:00 \_ [nvidia-modeset/] root 1143 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nvidia-modeset/] root 1146 0.1 0.0 0 0 ? S 14:45 0:00 \_ [irq/75-nvidia] root 1147 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nvidia] root 1148 0.1 0.0 0 0 ? S 14:45 0:00 \_ [nv_queue] root 1323 0.0 0.0 0 0 ? S 14:45 0:00 \_ [card0-crtc0] root 1324 0.0 0.0 0 0 ? S 14:45 0:00 \_ [card0-crtc1] root 1325 0.0 0.0 0 0 ? S 14:45 0:00 \_ [card0-crtc2] root 1326 0.0 0.0 0 0 ? S 14:45 0:00 \_ [card0-crtc3] root 1535 0.0 0.0 0 0 ? S 14:45 0:00 \_ [UVM global queu] root 1536 0.0 0.0 0 0 ? S 14:45 0:00 \_ [UVM deferred re] root 1569 0.0 0.0 0 0 ? S 14:45 0:00 \_ [UVM Tools Event] root 2102 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [kworker/u65:1] root 2105 0.0 0.0 0 0 ? S 14:45 0:00 \_ [lockd] root 2107 0.0 0.0 0 0 ? I< 14:45 0:00 \_ [iprt-VBoxWQueue] root 2108 0.0 0.0 0 0 ? S 14:45 0:00 \_ [iprt-VBoxTscThr] root 2124 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2125 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2126 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2127 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2128 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2129 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2130 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 2131 0.0 0.0 0 0 ? S 14:45 0:00 \_ [nfsd] root 4482 0.0 0.0 0 0 ? I 14:45 0:00 \_ [kworker/4:3-events] root 1 1.2 0.0 167232 12668 ? Ss 14:44 0:00 /sbin/init splash root 372 0.3 0.0 56556 19956 ? S
k0kubun commented 2 years ago

If you're open to clean installation, can you temporarily install Ubuntu 22.04 and try the same thing on it?

petrstepanov commented 2 years ago

If you're open to clean installation, can you temporarily install Ubuntu 22.04 and try the same thing on it?

Sure thing. I just installed Ubuntu 22.04, updated and ensured I'm in Wayland. Same problem appears to happen. I tried running xremap with and without sudo. πŸ˜“ I also tried external keyboard and another laptop to make sure it's not hardware related.

k0kubun commented 2 years ago

make sure it's not hardware related.

Given that we used the same combination of software, xremap / Ubuntu 22.04 on Wayland, and it worked on one machine and didn't on your machines, I'd say you already proved it's hardware related. If you run the same thing on the hardware I'm using, we know it works.

I also tried external keyboard and another laptop

Can you describe the full list of hardware combinations you've tried?

k0kubun commented 2 years ago

Also, can you possibly prepare a VirtualBox image that reproduces this problem?

petrstepanov commented 2 years ago

Good idea! Below please find download link to the .vdi file. I used Ubuntu 22.04 with minimal installation, all up-to-date. Credentials are following. User: testuser. Password: 1. https://disk.yandex.com/d/dkRXDzcs9hjmFg

The xremap installation details are summarized in the ~/Desktop/xremap-test/install.sh script. It downloads latest xremap version, patches session.conf, installs GNOME extension and copies the config file. I already ran the script so everything is installed.

Please run sudo xremap /usr/local/share/config-test.yml to test the issue. Below I attach the screencast demonstrating the faulty behavior on my end.

https://user-images.githubusercontent.com/859814/170790159-3192b72f-c7f8-40aa-92c0-65e6f0df2c15.mp4

Thank you for investigating the problem further. Looking forward to hearing from you!

P.S. While tinkering with the virtual machine, I tested the issue multiple times. One time I ran xremap, it consistently produced correct output (Shift+a gave b). Rest of the times I tried - I got wrong ouput (Shift+a produced B). It seems there is some inconsistency across subsequent runs of xremap?

k0kubun commented 2 years ago

Wow, I successfully reproduced the issue on that image. Thank you so much. I'll look into the issue using this.

k0kubun commented 2 years ago

I used Ubuntu 22.04 with minimal installation, all up-to-date.

May I ask for more details on how you created this image? Can you give me a link to the base image that you used? And, what you did on the base image is just set up a user and run the install.sh?

petrstepanov commented 2 years ago

Hi, @k0kubun here is the link to the Ubuntu image I used. It is simply a link from the official website: https://releases.ubuntu.com/22.04/ubuntu-22.04-desktop-amd64.iso

  • I downloaded and installed the image.
  • Updates were installed via Ubuntu GUI update utility.
  • On top of that I ran "sudo apt update && sudo apt upgrade".
  • Finally I executed the install.sh script.

To sum up - nothing special. Just official image with updates.

k0kubun commented 2 years ago

Update: As I'm currently focusing on a big change for another OSS, I'm planning to work on this issue on Aug 13th. If I receive a pull request before that, I can take a look at that too.

I finally noticed you were working on https://github.com/petrstepanov/gnome-macos-remap-wayland. I love that idea. I'll do my best to fix this as soon as possible.

petrstepanov commented 2 years ago

No problem and no rush. Thank you for your reply!

k0kubun commented 2 years ago

I had a look at this problem today https://github.com/k0kubun/xremap/issues/139#issuecomment-1214455449.

It seems like a bug in Wayland or at least something that Wayland handles differently from X11. I'll need to work on making a minimum repro and reporting it to the maintainers of Wayland and/or uinput to ask how this could be fixed. As I need to focus on conference preparations for a few weeks, please allow me to work on this after Sep 10th or so.

stephane-klein commented 2 years ago

Same issue for me, on Fedora 36, Gnome + Wayland.

petrstepanov commented 11 months ago

Hi @k0kubun how's it going! I am checking in with respect to the news that Fedora may drop X11 soon. I think current issue may draw more attention. I re-tested the issue on up-to-date Fedora 38 and can confirm its still present.

k0kubun commented 11 months ago

Hi :wave: https://github.com/k0kubun/xremap/pull/341 might have been potentially useful for this issue as well. If you haven't already, could you try adding keypress_delay_ms: 10 or keypress_delay_ms: 20 to your config?

petrstepanov commented 11 months ago

I confirm that adding keypress_delay_ms: 10 to the config.yml fixes current issue. Thank you, closing this thread.