Closed petrstepanov closed 11 months ago
To clarify. I tested this behavior on Fedora 36 with Wayland.
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.
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
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?
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.
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!
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?
echo
and ps aufx
in case you're curious.If you're open to clean installation, can you temporarily install Ubuntu 22.04 and try the same thing on it?
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.
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?
Also, can you possibly prepare a VirtualBox image that reproduces this problem?
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
?
Wow, I successfully reproduced the issue on that image. Thank you so much. I'll look into the issue using this.
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?
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
install.sh
script.To sum up - nothing special. Just official image with updates.
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.
No problem and no rush. Thank you for your reply!
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.
Same issue for me, on Fedora 36, Gnome + Wayland.
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.
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?
I confirm that adding keypress_delay_ms: 10
to the config.yml
fixes current issue. Thank you, closing this thread.
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 pressesShift-a
:Currently when I run the above configuration file and press
Shift-a
in a text editor, the uppercaseB
is output. This is due to the fact thatShift
modifier is "not released" and affects the output of a lowercase characterb
modifying it into a capitalizedB
.Is there any plan to implement a release functionality. Off the top of my head, the config file could be extended as follows:
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.