piater / uinputchars

A Linux utility to type character strings into /dev/uinput
GNU General Public License v3.0
9 stars 2 forks source link

Send special keys #1

Open MarSoft opened 4 years ago

MarSoft commented 4 years ago

Is it possible to send some hotkey combination with this tool? Something like Control+Super+X. If yes then how to prepare the correct stdin input for the tool?

piater commented 4 years ago

No, but it can be easily implemented.

Your question already identifies the core issue :-) The output generation should be trivially extensible to all relevant modifier keys. For input, one possibility is to define an escape syntax for modifier and other special keys. However, I feel that this violates the spirit of this tool that essentially implements an inverse keymap. I'd prefer to support hotkey combinations by special command-line options. For example, echo a | uinputchars -C might emit a Control+a.

I'll consider patches or may even implement it myself someday if people want it.

MarSoft commented 4 years ago

What about stuff like Ctrl+F4? They don't have corresponding text for stdin at all. Or maybe pass them as modifiers? Like this: echo -n | uinputchars -m Ctrl+F4

вт, 18 февр. 2020 г., 0:41 Justus Piater notifications@github.com:

No, but it can be easily implemented.

Your question already identifies the core issue :-) The output generation should be trivially extensible to all relevant modifier keys. For input, one possibility is to define an escape syntax for modifier and other special keys. However, I feel that this violates the spirit of this tool that essentially implements an inverse keymap. I'd prefer to support hotkey combinations by special command-line options. For example, echo a | uinputchars -C might emit a Control+a.

I'll consider patches or may even implement it myself someday if people want it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/piater/uinputchars/issues/1?email_source=notifications&email_token=AABJZ224PONXEYAEQJCJX23RDL77XA5CNFSM4KWYE2B2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL7XPWY#issuecomment-587167707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABJZ23EPQNANZHVC4VDVFLRDL77XANCNFSM4KWYE2BQ .

piater commented 4 years ago

Good point. Technically, function keys are also subject to keymap translation, as are modifier keys. So maybe the best course of action is an escape syntax after all. Since key press and key release events are emitted separately, one might separate the issues of literal vs. escaped input and key press vs release events. Thinking aloud, how about:

Examples: