This is useful primarily as a method of avoiding the command completion problem with bash aliases, but I'm sure there are other uses I just haven't yet considered.
Here's a small bit of my ~/.config/openbox/rc.xml file:
<keybind key="W-p"> <keybind key="s"> <action name="Execute"> <command>xdotool keyup "s" type 'systemctl '</command> </action> </keybind> </keybind> <keybind key="W-k"> <action name="Execute"> <command>xdotool keyup "super+k" type 'systemctl '</command> </action> </keybind>
Using xdotool is fairly straightforward. The only piece that requires explanation is the need for the keyup argument.
For keybindings in openbox, the action is done on key down. Thus we use xdotool to force X to consider the key up. Otherwise the keybinding keys will still be considered down, which can lead to all sorts of unexpected behavior.