One of the features I've missed in Windows 7 is that you can pin your favourite files to the application icon's right click menu. Luckily, I've since discovered, that you can create so called "actions" in a particular application's desktop file, so you can access your desired files by right clicking on the application icon by adding the following lines to the .desktop file:


[Desktop Action Action 1]
Name=Name which appears in right click menu
Exec=gedit "path/to/file"

[Desktop Action Action 2]

And so on.

However, upgrading to Ubuntu 16.04 while this works with other application icons, with Gedit now it doesn't behave accordingly. Unless I open the application beforehand, using the right click menu items detaches the Gedit task icon from the dash locked icon. Image:

This is what it looks:

The upper one is the locked dash icon, accessible by SUPER-9, and the lower one is what opened when clicked on the one of the right click items of the dash locked icon. Because of that, I can't switch to gedit with the SUPER-9 keystroke, it creates a new document in it instead.

  • Which one did you edit, the original one in /usr/share/applications, or a local copy in ~/.local/share/applications. Also Please edit and add the output of both: find /usr/share/applications -name *gedit* and find ~/.local/share/applications -name *gedit* – Jacob Vlijm Dec 20 '16 at 16:20

The solution is to use the xdg-open instead of gedit in the Exec command of the action. Example:

[Desktop Action Action 1]
Name=My bookmarks
Exec=xdg-open "Documents/my_bookmarks"

Tip: if you want to open more than one files with a right-click menu, you can't do it directly in the desktop file because xdg-open doesn't allow opening multiple files in one command. You have to make a shell script, with a for loop, like this:

for i in "Documents/document 1.txt" "Documents/document 2.txt"; do
   xdg-open "$i"

Put the script in your scripts directory, and use that in your desktop action's Exec line.

  • This answer makes no sense. Like you posted it, it cannot possibly work. Furthermore; apart from the typo(s) in the Exec= line, the cause is a totally different one. – Jacob Vlijm Dec 20 '16 at 16:23
  • Why wouldn't work? Changing gedit to xdg-open in the actions solved the issue for me. However I've noticed the Exec typos, so I've fixed it. – Negirno Dec 21 '16 at 14:57

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.