Ubuntu – How to create working shortcuts

nautilusshortcuts

I don't know why this isn't an option by default in Ubuntu because you'd think it would be pretty important but as far as I've researched the only way to add more options to the nautilus right click menu is to install the package nautilus-actions which, by the way, isn't available in the Software Center anymore.

I followed this guide to install it, however what I didn't realise is that after installing it I would have to customise my own commands to actually have them appear.

What do I need to do after installing this package to have a simple "Create Shortcut" option?

Can I just download a pre-configured set of options?


Edit:

Just to be clear, there's a bunch of guides that explain how to start the gnome-desktop-item-edit, I'm asking if there's a way to make it more automatic so that I can

  • Right click any Application
  • Select Create Shortcut
  • Have a shortcut to that Application created inside the current folder

Essentially what Windows does

There is an option on nautilus that allows to "Create Links", unfortunately as soon as the Link is moved outside of the folder it was created in it will stop opening the Application when clicked.


Edit2:

The problem is that I cannot create Shortcuts to my applications without doing a lot of really annoying steps.
I'm going to use my Wine Photoshop installation as an example for this.

To run Photoshop through Wine, I can just open my terminal and paste:

WINEPREFIX=/home/leonardo/Photoshop wine64 /home/leonardo/Photoshop/Photoshop.exe

And this will easily launch the application.

However, say I wanted to have a shortcut on my Desktop that launches this command.

enter image description here

I create it like this, I double click it, and it just gives me this error

enter image description here

This happens with pretty much every single application I try to create a shortcut command to.

cd /home/leonardo/quakespasm && ./quakespasm-sdl2

This works perfectly in terminal, however once I create a shortcut to it, the application doesn't launch and gives me the same error as above.

The only way (that I have found) to get around this is create a file like this:

#!/bin/bash
WINEPREFIX=/home/leonardo/Photoshop wine64 /home/leonardo/Photoshop/Photoshop.exe

And then create a shortcut to launch that file.

Is there any way where I could just create a shortcut to the command and have it work?

Best Answer

Okay I've got it figured it out, mostly thanks to the help of the folks over at Ubuntu Forums. I'm going to write it here for posterity, although I do still think a lot of this should be included with Ubuntu.

Links don't work

I haven't been able to figure those out, creating a link to an application and moving the link outside the current folder causes a lot of problems. In my particular case, Ubuntu thought the application was being launched from the location of the Link which meant that the application couldn't load its data.

I just kind of gave up on the idea of getting these to work as they just don't seem reliable enough. Either way, getting Terminal Command Shortcuts is much better.

Right Click to Create Shortcut

Thanks to user mc4man on Ubuntu Forums for this.

  1. Install the correct filemanager-actions you need by following this guide (the default Ubuntu file explorer is Nautilus)
  2. Run fma-config-tool

Then just set it up like this:

enter image description here

enter image description here

This will add an option when right-clicking inside Nautilus that will bring up the Shortcut creator app to add a shortcut in the current folder. This option will be in a sub-menu by default, but you can go into Edit -> Preferences -> Runtime Preferences and deselect "Create a root filemanager-actions menu"

enter image description here

Creating Shortcuts for Programs that don't start with a program

Programs running through Wine often require to launch a command with "WINEPREFIX=/path/to/prefix", this causes problems when trying to create shortcuts for them because they just won't get recognised as programs and fail to start.

There's an easy fix for that. Instead of creating a command for

WINEPREFIX="/home/leonardo/Photoshop" wine64  "/home/leonardo/Photoshop/Photoshop.exe"

You can just add env at the start:

env WINEPREFIX="/home/leonardo/Photoshop" wine64  "/home/leonardo/Photoshop/Photoshop.exe"

This will work.

Ubuntu 19.04 Disco Dingo Update

Updating this because GNOME's dumb and they changed how shortcuts work. The above to launch wine applications will not work if the shortcut is launched from Desktop/Nautilus.

Take the .desktop file you just created and move it inside /home/leonardo/.local/share/applications. This will add the shortcut to your application list and you'll be able to start it there.