3

Just to clarify, I do not want to create keyboard shortcuts that run desktop icons.

Is there any way to create a desktop shortcut that, when clicked, runs a keyboard shortcut combination? I find the Super +Shift +W shortcut to be extremely useful, but I am often using the mouse only for extended periods, and switching windows frequently. Going to the keyboard to do so is rather tedious.

can I make a desktop icon that runs Super +Shift +W when clicked?
I am aware that there are other questions of a similar nature, but none I have found have really answered the question.

  • The appropriate way, to indicate if an answer is either helpful or the (complete) solution to your problem, is to accept or upvote an answer. If none of the answers was useful, you can post an answer, describing what was your solution. Please do not post "Thank you" as an answer to your own question. See also askubuntu.com/help/someone-answers – Jacob Vlijm Jan 31 '15 at 21:35
2

The very "basic" version of what you are looking for would be:

[Desktop Entry]
Name=Show
Exec=/bin/bash -c "sleep 0.25&&xdotool key Shift_L+Super_L+w"
Type=Application

How to use

  • You would have to install xdotool (as mentioned by @Takkat):

    sudo apt-get install xdotool
    
  • Then paste the code above into an empty file, save it as (e.g.): show.desktop

  • Then:
    • if you want to run it from your desktop: make it executable and run it by double-click
    • If you want to run it from the Launcher: move it into ~/.local/share/applications, drag it from there on to the Launcher.

Explanation

With xdotool, you can simulate keyboard strokes. The command to run your keyboard combination by xdotool is:

xdotool key Shift_L+Super_L+w

Why the pause of 0.25 sec?

Without the pause, the script would start while you were double clicking the icon, and break the command.

If you strictly use the starter from the Launcher, the Exec= line can be:

Exec=/bin/bash -c "xdotool key Shift_L+Super_L+w"

Note

The .desktop file is the most (possible) basic version of a .desktop file. You can "dress" it with an icon, for example, with an Icon= line, with the path to an icon you'd want to use. More on options here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.