rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.71k stars 157 forks source link

External TrackPoint cursor speed changes to default while keyd is running #794

Closed mateusmeloxyz closed 1 month ago

mateusmeloxyz commented 1 month ago

I'm using a ThinkPad T480 with an external Lenovo ThinkPad Compact USB Keyboard with TrackPoint on Fedora Linux 40 with Gnome 46 running on Wayland.

When running systemctl start keyd, the cursor speed when using the TrackPoint on the external USB keyboard is slowed down to the default speed, even though the cursor speed is set to max on the gnome settings.

This only happens with the external TrackPoint. The TrackPoint that is attached to the laptop is unaffected.

I haven't found a similar issue and I couldn't find an easy fix, but it seems that keyd is overwriting some settings related to the external USB keyboard based on the debug output below. Maybe it's just a configuration issue from my end.

Any help is appreciated.

My /etc/keyd/default.conf file:

[ids]

*

[main]

shift = oneshot(shift)
meta = oneshot(meta)
control = oneshot(control)

leftalt = oneshot(alt)
rightalt = oneshot(altgr)

capslock = overload(control, esc)
insert = S-insert

esc = capslock

KEYD_DEBUG=1 keyd output:

sudo KEYD_DEBUG=1 keyd
DEBUG: src/keyd.c:230: Debug mode activated
CONFIG: parsing /etc/keyd/default.conf
Starting keyd v2.4.3 (ce1bab6)
DEVICE: match    0001:0001:a38e6885  /etc/keyd/default.conf (AT Translated Set 2 keyboard)
DEVICE: match    17ef:6047:00d52654  /etc/keyd/default.conf (Lenovo ThinkPad Compact USB Keyboard with TrackPoint)
DEVICE: match    17ef:6047:b3c60151  /etc/keyd/default.conf (Lenovo ThinkPad Compact USB Keyboard with TrackPoint)
DEVICE: match    0000:0006:bdb72f48  /etc/keyd/default.conf (Video Bus)
DEVICE: match    0000:0006:bdb72f48  /etc/keyd/default.conf (Video Bus)
DEVICE: match    17aa:5054:101d4f25  /etc/keyd/default.conf (ThinkPad Extra Buttons)
DEVICE: ignoring 06cb:0000:11917735  (Synaptics TM3276-022)
DEVICE: ignoring 0002:000a:f1080be4  (TPPS/2 IBM TrackPoint)
DEVICE: ignoring 0fac:1ade:d2b36ae6  (keyd virtual pointer)
DEBUG: src/daemon.c:449: input leftmouse down
DEBUG: src/vkbd/uinput.c:336: output leftmouse down
DEBUG: src/daemon.c:449: input leftmouse up
DEBUG: src/vkbd/uinput.c:336: output leftmouse up
DEBUG: src/daemon.c:449: input leftmouse down
DEBUG: src/vkbd/uinput.c:336: output leftmouse down

fastfetch output:

             .',;::::;,'.                 mgm@fedora
         .';:cccccccccccc:;,.             ----------
      .;cccccccccccccccccccccc;.          OS: Fedora Linux 40 (Workstation Edition) x86_64
    .:cccccccccccccccccccccccccc:.        Host: 20L6S7PE26 (ThinkPad T480)
  .;ccccccccccccc;.:dddl:.;ccccccc;.      Kernel: Linux 6.9.8-200.fc40.x86_64
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.     Uptime: 1 day, 57 mins
.:ccccccccccccc;KMMc;cc;xMMc;ccccccc:.    Packages: 2462 (rpm), 3 (flatpak)
,cccccccccccccc;MMM.;cc;;WW:;cccccccc,    Shell: bash 5.2.26
:cccccccccccccc;MMM.;cccccccccccccccc:    Display (LGD0521): 1920x1080 @ 60Hz [Built-in]
:ccccccc;oxOOOo;MMM000k.;cccccccccccc:    Display (Northgate Computer Systems 15"): 1440x900 @ 60Hz [External]
cccccc;0MMKxdd:;MMMkddc.;cccccccccccc;    DE: GNOME 46.3.1
ccccc;XMO';cccc;MMM.;cccccccccccccccc'    WM: Mutter (Wayland)
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;     WM Theme: Adwaita
ccccc;0MNc.ccc.xMMd;ccccccccccccccc;      Theme: Adwaita [GTK2/3/4]
cccccc;dNMWXXXWM0:;cccccccccccccc:,       Icons: Adwaita [GTK2/3/4]
cccccccc;.:odl:.;cccccccccccccc:,.        Font: Cantarell (11pt) [GTK2/3/4]
ccccccccccccccccccccccccccccc:'.          Cursor: Adwaita (24px)
:ccccccccccccccccccccccc:;,..             Terminal: GNOME Terminal 3.50.1
 ':cccccccccccccccc::;,.                  Terminal Font: Source Code Pro (10pt)
                                          CPU: Intel(R) Core(TM) i7-8650U (8) @ 4.20 GHz
                                          GPU 1: Intel UHD Graphics 620 @ 1.15 GHz [Integrated]
                                          GPU 2: NVIDIA GeForce MX150 [Discrete]
                                          Memory: 4.80 GiB / 15.49 GiB (31%)
                                          Swap: 2.02 MiB / 8.00 GiB (0%)
                                          Disk (/): 255.31 GiB / 475.35 GiB (54%) - btrfs
                                          Local IP (wlp3s0): 192.168.0.102/24 *
                                          Battery 1: 100% [AC Connected]
                                          Battery 2: 95% [AC Connected]
                                          Locale: en_US.UTF-8

                                          ████████████████████████
                                          ████████████████████████
mateusmeloxyz commented 1 month ago

Can confirm that this also happens on my X220 running Ubuntu with the same keyd config file.

sudo KEYD_DEBUG=1 keyd output:

DEBUG: src/keyd.c:230: Debug mode activated
CONFIG: parsing /etc/keyd/default.conf
Starting keyd v2.4.3 (ce1bab6)
DEVICE: match    0001:0001:a38e6885  /etc/keyd/default.conf (AT Translated Set 2 keyboard)
DEVICE: match    17aa:5054:101d4f25  /etc/keyd/default.conf (ThinkPad Extra Buttons)
DEVICE: ignoring 0002:0007:b86ee257  (SynPS/2 Synaptics TouchPad)
DEVICE: ignoring 0002:000a:f1080be4  (TPPS/2 IBM TrackPoint)
DEVICE: match    0000:0006:bdb72f48  /etc/keyd/default.conf (Video Bus)
DEVICE: match    17ef:6047:00d52654  /etc/keyd/default.conf (Lenovo ThinkPad Compact USB Keyboard with TrackPoint)
DEVICE: match    17ef:6047:b3c60151  /etc/keyd/default.conf (Lenovo ThinkPad Compact USB Keyboard with TrackPoint)
DEVICE: ignoring 0fac:1ade:d2b36ae6  (keyd virtual pointer)
DEBUG: src/daemon.c:449: input leftmouse down
DEBUG: src/vkbd/uinput.c:336: output leftmouse down

fastfetch output:

                           ....               mateus-melo@mateus-melo-ThinkPad0
              .',:clooo:  .:looooo:.           ---------------------------------
           .;looooooooc  .oooooooooo'          OS: Ubuntu noble 24.04 x86_64
        .;looooool:,''.  :ooooooooooc          Host: 4291RC7 (ThinkPad X220)
       ;looool;.         'oooooooooo,          Kernel: Linux 6.8.0-36-generic
      ;clool'             .cooooooc.  ,,       Uptime: 10 mins
         ...                ......  .:oo,      Packages: 2060 (dpkg), 10 (snap)
  .;clol:,.                        .loooo'     Shell: bash 5.2.21
 :ooooooooo,                        'ooool     Display (LGD02D8): 1366x768 @ 60z
'ooooooooooo.                        loooo.    DE: GNOME 46.0
'ooooooooool                         coooo.    WM: Mutter (Wayland)
 ,loooooooc.                        .loooo.    WM Theme: Yaru-dark
   .,;;;'.                          ;ooooc     Theme: Yaru-dark [GTK2/3/4]
       ...                         ,ooool.     Icons: Yaru-dark [GTK2/3/4]
    .cooooc.              ..',,'.  .cooo.      Font: Ubuntu Sans (11pt) [GTK2/3]
      ;ooooo:.           ;oooooooc.  :l.       Cursor: Yaru (24px)
       .coooooc,..      coooooooooo.           Terminal: GNOME Terminal 3.52.0
         .:ooooooolc:. .ooooooooooo'           Terminal Font: Ubuntu Sans Mono )
           .':loooooo;  ,oooooooooc            CPU: Intel(R) Core(TM) i5-2520M z
               ..';::c'  .;loooo:'             GPU: Intel 2nd Generation Core P]
                                               Memory: 3,11 GiB / 7,64 GiB (41%)
                                               Swap: 0 B / 4,00 GiB (0%)
                                               Disk (/): 24,65 GiB / 108,44 GiB4
                                               Local IP (wlp3s0): 192.168.0.102*
                                               Battery: 30% [Charging]
                                               Locale: pt_BR.UTF-8

                                               ████████████████████████
                                               ████████████████████████
tkna91 commented 1 month ago

Try specifying the keyboard id specifically. Mouse support is limited.

[id]
k:0001:0001
mateusmeloxyz commented 1 month ago

Try specifying the keyboard id specifically. Mouse support is limited.

[id]
k:0001:0001

That worked! Thanks!

I added the internal keyboard id and the first of the 2 ids from the external keyboard, and it works fine now.

It seems like that the first id from the external keyboard refers to the keys themselves and the second id refers to the trackpoint.

My /etc/keyd/default.conf file now looks like this:

[ids]
k:0001:0001
k:17ef:6047:00d52654

[main]

shift = oneshot(shift)
control = oneshot(control)

leftalt = oneshot(alt)
rightalt = oneshot(altgr)

capslock = overload(control, esc)
insert = S-insert

esc = capslock

Alternatively, could I tell it to ignore the external keyboard second id?

tkna91 commented 1 month ago

Devices not specified with [ids] are ignored.

rvaiya commented 1 month ago
[ids]

0001:0001
17ef:6047:00d52654

should also work, and is the recommended approach. The old [km]: prefixes were introduced to account for device nodes which could not solely be distinguished by product/vendor ids, but that should no longer be an issue as of ca9aa51.

mateusmeloxyz commented 1 month ago
[ids]

0001:0001
17ef:6047:00d52654

should also work, and is the recommended approach. The old [km]: prefixes were introduced to account for device nodes which could not solely be distinguished by product/vendor ids, but that should no longer be an issue as of ca9aa51.

Worked flawlessly. Thanks!

rchaucha commented 2 weeks ago

I have the same problem but I need to remap my mouse buttons, which can't be achieved without having my mouse cursor acceleration reset to default. I understand that mouse support is limited, but can't this stay as an open issue?

tkna91 commented 2 weeks ago

Indeed, it might be better to separate the actions for moving the mouse pointer from the rest of the actions. I imagine that would help to avoid this problem. https://github.com/rvaiya/keyd/issues/451

@rvaiya What do you think?

https://github.com/user-attachments/assets/89704ed3-b1c0-4da7-a43b-3439d297d3d6