Programming "Function keys"

I am curious about something I read in kbdcontrol().
-f # string
Set function key number # to send string. Refer to the man page
for the keyboard driver (e.g. atkbd(4)) for available function
keys and their numbers.
I am a little new to BSD and couldn't get it working... in FVWM I couldn't get kbdcontrol -d (to dump keyboard layout onto stdout) to work, but after pressing ctrl+alt+F2 and entering it there it worked. I tried kbdcontrol -f 1 ls and it did not appear to do anything. Is this functionality meant to work, and if it is would it work after starting X, after starting FVWM2? It sounds quite handy, but there isn't much info on google.
 
Last edited:
I have experimented with hotkeys in FVWM and with sxhkd and there were some issues when trying to get a shortcut to print text with the 3 programs I tried to output text with... xdotool, xte (from xautomation) and xvkbd. The problem, mainly, was that I needed to insert delays of .1 to .25 seconds before the "output text" command or the start of the output would be clipped. I would have to use code like (sxhkd example with a line I'd put in the sxhkdrc):
Code:
mod5 + BackSpace
sleep 0.25;xdotool type -delay 0 email@address.com
I have been searching for a solution to this problem for months, one solution would be to use an Arduino programmed with QMK firmware connected to an array of buttons programmed to send strings when buttons are pressed.... I will probably try that soon.
 
I have experimented with hotkeys in FVWM [...] there were some issues when trying to get a shortcut to print text with the 3 programs I tried to output text with... xdotool, xte (from xautomation) and xvkbd. The problem, mainly, was that I needed to insert delays of .1 to .25 seconds before the "output text" command or the start of the output would be clipped.
Anything wrong with
Code:
key F12 A N Function SomeFunction

...

DestroyFunc SomeFunction
AddToFunc SomeFunction
+ I Exec sleep 1; some_command & sleep 1; another_command
?
 
Well I mean I want to get rid of the delays.... and I found also the delay needed varies quite a bit, I expect at high CPU load I would get clipping of the start of the output... it just feels sloppy and unresponsive compared to macros I program on my programmable gaming mice or QMK keyboard. I can do it just as well either with sxhkd or with the FVWM config but the results are the same. I'm actually thinking of putting an Arduino running QMK firmware into a Redragon Legend mouse (16 side thumb buttons) and wiring the side and top buttons to the Arduino and having full QMK control over them, with layers and macros and LED control (those mice have lots of LEDs in them) etc.

I found also a mention of it in keyboard().
The keys on the keyboard can have any of the following functions:

Normal key Enter the ASCII value associated with the key.
Function key Enter a string of ASCII values.
Switch Key Switch virtual console.
Modifier Key Change the meaning of another key.
And kbdcontrol()
EXAMPLES

...

The following command will make the function key 10 emit "telnet myhost".

kbdcontrol -f 10 "telnet myhost"
Would that make the keyboard type "telnet myhost" or send the command "telnet myhost"? I'm wanting it to type "telnet myhost". It would be good if it did that because there are dozens of function keys available in /usr/local/include/X11/keysymdef.h ...
/*
* Auxiliary functions; note the duplicate definitions for left and right
* function keys; Sun keyboards and a few other manufacturers have such
* function key groups on the left and/or right sides of the keyboard.
* We've not found a keyboard with more than 35 function keys total.
*/
... which could very likely be programmed into QMK firmware and it would solve my "xdotool type string" issues.
 
Back
Top