Creating a shortcut in Gnome-Shell is a bit harder than it was in the classic Gnome 2 desktop. There are some applications you can use that will build the shortcut file itself for you, but you still need to know where to place it. Here we’ll build up a simple shortcut file, and place it into the current user’s environment so it gets picked up by Gnome-Shell.
The Shortcut File
The shortcut file is a relatively simple format. You can find more details at the Gnome Developer site, but for simple cases the following format should work for you.
[Desktop Entry] Type=Application Name=Update eugenemdavis.net Comment=Update script for eugenemdavis.net Icon=/home/eugene/Code/personal/favicon.ico Exec=/home/eugene/Code/personal/upload.sh Terminal=true Categories=Web;Development
In this case, I’m creating an icon to launch the script to build and update my website. Let’s breakdown each line of the file:
[Desktop Entry]- Indicates that this is a shortcut file
Type=Application- Indicates that this is a shortcut for an application
Name- Name to give to the shortcut
Comment- Add a comment to the shortcut. This isn’t really all that helpful in Gnome-Shell by default, since it doesn’t seem to get displayed anywhere.
Icon- Link to an image file to use as an icon. Supports a number of file types, not just
Exec- The file to execute
Terminal- Boolean (true or false) value to indicate if this shortcut should launch the program in a terminal. If it’s a graphical application, you’ll probably want to leave this as false
Categories- Categories to link the shortcut file to
Saving the File
You must save the file both in the correct location, and with the correct name.
All desktop files will end with the extension
.desktop, but you prior to that extension it must be named exactly the same as the full name of the executable you are looking to launch.
This includes the extension - so in my case the filename would be named
upload.sh.desktop, not simply
Once you have the file named and saved, copy it to
~/.local/share/applications/ to load it into your current user’s Gnome-Shell environment.
You should now be able to open up the applications and see the new shortcut there, as shown in the title image.
This shortcut should function just like any other Gnome shortcut does.