I wanted a hotkey to insert the current date at the cursor in ALL programs. Turns out this is rather tricky, because there is (of course) no common API to “insert text” in all X programs (open standards means you can get it to work with slightly less Perl than proprietary standards. Or more Perl and less wireshark).
The best solution (not so great) I have so far is to use xmacro. The input to xmacro would look something like this:
Delay 1 String 2006-03-27
Where “Delay 1” gives you 1 second to take your fingers off the keys.
So a handy script can generate this macro for any desired string:
#!/bin/bash echo Delay 1 while read line ; do echo "String $line" done
Then a handy script can feed it into xmacroplay:
#!/bin/sh type-gen-macro | xmacroplay $DISPLAY
And a shortcut can be assigned to
date +'%F' | xtype
Hacky and slow, but it works.