Ubuntu – Why does the xdotool key command not work

15.04command linexdotool

I'm trying to run this command:

xdotool key ctrl+super+d

It is supposed to toggle-show desktop, but it won't work. When I press the keys myself it works though.

Best Answer

The correct command is:

xdotool key Control_L+Super_L+d

To find the correct key- mentions, use xev: In a terminal window, run the command xev + Return, then type the key you'd like to use in the xdotool command. The output will be like:

KeyPress event, serial 37, synthetic NO, window 0x4c00001,
    root 0x260, subw 0x0, time 64862215, (-177,259), root:(1325,592),
    state 0x10, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

where the information you are looking for is in the section:

(keysym 0xffeb, Super_L)

Alternatively, you can use the keysym -value:

xdotool key Control_L+0xffeb+d

or the key code:

xdotool key Control_L+133+d

Additional information

As mentioned by @DKBose:
on 14.04, the command, used by OP should work, as mentioned in man xdotool on 14.04.3:

Generally, any valid X Keysym string will work. Multiple keys are separated by '+'. Aliases exist for "alt", "ctrl", "shift", "super", and "meta" which all map to Foo_L, such as Alt_L and Control_L .

However, OP mentions the tag 15.04, and on 15.04, the passage is missing in man xdotool, and the aliasses do not work any more. The values, found in the output of xev should be used.