ReimuNotMoe / ydotool

Generic command-line automation tool (no X!)
GNU Affero General Public License v3.0
1.52k stars 81 forks source link

Where are the "click" keycodes coming from? #219

Open jdnixx opened 10 months ago

jdnixx commented 10 months ago

Since 1.0.0 and on requires actual key codes instead of key names, I see the note about getting key codes from /usr/include/linux/input-event-codes.h. And I see in the examples, you use e.g. 29 (KEY_LEFTCTRL), 56 (KEY_LEFTALT) and 59 (KEY_F1) which are there in the input-event-codes.h file.

But for clicks, you use 0xC1 for right-click for example, which I don't see anywhere there in the file. It looks like BTN_RIGHT is 0x111, which doesn't seem to do anything in ydotool (ydotool click 0x111). Where are the C0, C1 etc codes coming from?

Also, I have to add that having to look up in the table for each & every single code is quite annoying. Should've just kept the name scheme IMO.

mibmo commented 8 months ago

Also, I have to add that having to look up in the table for each & every single code is quite annoying. Should've just kept the name scheme IMO.

I guessing this is to avoid confusing when using a different keyboard layout, i.e. "why does xdotool type ; instead type æ?". Exposing the codes directly forces the user to at least acknowledge that issues may arise. But yes - perhaps an easy tool (like xev) that can show the keycodes for a given key would be nice.