# Shortcuts to autotype text using Openbox and xdotool.

Author
Michael
Published
2013, Sep 30, 10:05 pm
Category
TechLinux
Tags
Linux, Openbox, xdotool

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.

One of the problems with bash aliases is that they break command completion, and although there is a solution, it's fairly complex. I have a simpler answer using openbox and xdotool.

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.