I am using Lubuntu 16.04 xenial)

My keyboard layout is
$setxkbmap -query
rules: evdev
model: pc105
layout: gb

I have searched for an xdotool forum and can't find one so if anyone knows a better or more targeted place to post please let me know.

I have the utilities xdotool and xclip installed, and have a query about 'spurious' output of xdotool when using these tools in a combined way.

I am using both these tools so I can create a keyboard shortcut for various useful text phrases I use often, such as my email address.

So, I can get the email address johnxyzz_@name.com (not my email address) onto the clipboard by using xclip
echo johnxyzz_@name.com | xclip
then paste the contents of the clipboard by typing
xclip -o

I can get xdotool to paste clipboard contents into the currently focused window, which ever one that happens to be, with the command
sleep 0.5;xdotool type "$(xclip -o)"

So, the portion of my lubuntu-rc.xml (Openbox) file relating to this keyboard shortcut looks like this

<keybind key="w-c-a-5">
<action name="Execute"><command>bash -c 'echo 'john@name.com' | xclip';'sleep 0.5; xdotool type "$(xclip -o)"'</command></action>

The problem is, as you can see, that the following is pasted when using the above combined command sequence
echo johnxyzz_@name.com | xclip;sleep 0.5;xdotool type "$(xclip -o)"


In other words a
'q'[B] appears instead of the desired '@'

I have done a considerable amount of research in an effort to resolve this.
I have tried
xdotool type key at
and other variants

xmodmap -pk > keymap.txt
produces the following relevant lines

There are 7 KeySyms per KeyCode; KeyCodes range from 8 to 255.
KeyCode Keysym (Keysym) ...
Value Value (Name) ...
24 0x0071 (q) 0x0051 (Q) 0x0071 (q) 0x0051 (Q) 0x0040 (at) 0x07d9 (Greek_OMEGA) 0x0040 (at)
48 0x0027 (apostrophe) 0x0040 (at) 0x0027 (apostrophe) 0x0040 (at) 0xfe52 (dead_circumflex) 0xfe5a (dead_caron) 0xfe52 (dead_circumflex)

The above table shows that q and apostrophe ' appear before @ in the keycodes table.

Some of the keycodes do however respond as expected eg
xdotool key Shift_L+e


I got the @ symbol by using the following line
xdotool key Shift_L+48

So, the portion of my lubuntu-rc.xml (Openbox) file relating to this keyboard shortcut looks like this

<keybind key="w-c-a-5">
<action name="Execute"><command>
bash -c 'echo 'kessack' | xclip';
'sleep 0.5; xdotool type "$(xclip -o)"';
'sleep 0.9; xdotool key shift_L+48';
'echo 'gmail.com' | xclip';'sleep 0.5; xdotool type "$(xclip -o)"'

It works.

xdotool is potentially a very good tool but needs more development; on occasion when pressing the w-c-a-5 key sequence this keybinding invokes about 10 other keybindings and lots of windows or files associated with those keybindings open.

Hopefully this post saves someone a lot of trouble.