2

/usr/bin/gnome-desktop-item-edit ~/Desktop/ --create-new is the linux command for creating Desktop shortcuts.

So naturally the first shortcut I need is a short cut to the command:

/usr/bin/gnome-desktop-item-edit ~/Desktop/ --create-new

When I create the shortcut it will not execute. I am using 18.04 and the text of the shortcut created is below. I have also created it with Terminal attribute set to true but that also sits there and does nothing. I have also tried placing the command inside a bash shell script and making sure everything is executable. Nothing works.

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=gnome-panel-launcher
Name[en_US]=CreateLauncher
Exec=/usr/bin/gnome-desktop-item-edit ~/Desktop/ --create-new
Name=CreateLauncher
Icon=gnome-panel-launcher
blogman
  • 83

2 Answers2

1

It seems the error lies in Exec value. Desktop entries need absolute paths. So, replace ~/Desktop/ with /home/username/Desktop/ such that value of Exec in desktop entry looks like:

Exec=/usr/bin/gnome-desktop-item-edit /home/username/Desktop/ --create-new

Explanation:

From Desktop Entry Specification -

The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment. The name or path of the executable program may not contain the equal sign ("="). Arguments are separated by a space.

Kulfy
  • 18,154
0

I could do this with the below way..

  1. create a script named cl.sh on Desktop to run the command /usr/bin/gnome-desktop-item-edit ~/Desktop/ --create-new with below content.

    Content of the script

    #!/bin/bash
    
    /usr/bin/gnome-desktop-item-edit ~/Desktop/ --create-new
    
  2. cd ~/Desktop

  3. Make the script executable with chmod a+x cl.sh
  4. Open the "Create Launcher" with ./cl.sh
    A dialog "Create Launcher" will pop up.
  5. Give the command as /home/user/Desktop/cl.sh Replace user with your username
  6. Click the Icon on Desktop and click trust and launch.

enter image description here