keycodes_from_xmodmap
returns one-to-one mapping instead of one-to-many
#316
Labels
bug
Something isn't working
Background
I want to define a key mapping to control Spotify via DBus. For that, I want to link
XF86AudioPlay
key (Fn+F9 on my keyboard) with aspawn("dbus-send ...")
. However, it didn't work: the key press did nothing.The issue
Digging into the code, I discovered the following.
parse_keybindings_with_xmodmap
works by getting a mapping from String to u8 fromkeycodes_from_xmodmap
and using that to convert key names likeXF86AudioPlay
to key codes like172
.keycodes_from_xmodmap
executesxmodmap -pke
. This command dumps keycode mappings in lines of the following format:collect
ed into aHashMap
.xmodmap -pke | grep -i xf86audioplay
outputs the following:keycodes_from_xmodmap
would first turn it into the following pairs:collect
, just into a mappingxev
utility, I confirmed that pressing "Play" button of my keyboard emits keycode 172. Thus, it doesn't get captured by Penrose.Possible fix
Possible fix would modify the logic of
keycodes_from_xmodmap
so that it returnsResult<HashMap<String, Vec<u8>>>
instead ofResult<HashMap<String, u8>>
and then adaptingparse_bindings_with_xmodmap
/parse_binding
functions. I am not sure how popular is this problem, though, and whether changing the signature ofkeycodes_from_xmodmap
worth it. In any case, I am open to implementing it.System details
I run Penrose on Arch Linux with
startx
.setxkbmap -print -verbose 10
returns this:It is a fairly standard configuration with English / Russian layout switch on CapsLock.
My keyboard is Logitech G Pro:
Picture of the keyboard
The text was updated successfully, but these errors were encountered: