1

I created a shortcut for sublime text 3 (sublime_text.desktop)[The file with the good looking icon] and this happened,

my shortcut location and my executable location

error message

The code i used in sublime_text.desktop

#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Sublime Text
Comment=Sophisticated text editor for code, markup and prose
Icon=sublime-text
Exec=./sublime_text
Terminal=true
Categories=Development;IDE;

I've used many similar examples but didnt work(and yes double clicking sublime_text executable works).

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Suraj Mandal
  • 111
  • 4

1 Answers1

1

I don't think that this will work:

Exec=./sublime_text

Use full path instead.

Exec=/full/path/to/sublime_text

To make it work with ./sublime_text you need to have .desktop file and executable file in the same current working directory (.)

If yet does not open, then check for permission issues. When you call the .desktop file with a double click or from your DE apps menu then the .desktop file is executed as user.
If the folder you have your executable file is a root folder, execution will fail due to missing priveleges.
Users can not run root progs, unless the permissions have been set to apply such operation (allow execution by others).

George Vasiliou
  • 7,803
  • 3
  • 18
  • 42
  • i specifically mentioned that i dont want to use full paths & without ./ it does not work either – Suraj Mandal Feb 07 '17 at 14:42
  • @surajmandalcell What's wrong with full paths? In order to make ./ to work the .desktop file and the executable file it seems that must be in the same directory, but yet is not 100% sure that will work – George Vasiliou Feb 07 '17 at 14:45
  • it didnt :( sorry but i dont know what am i doing wrong – Suraj Mandal Feb 07 '17 at 14:46
  • @surajmandalcell Check for permissions. If you call the .desktop file from a double click on your desktop or from your DE apps menu then the .desktop file is called as user. if the folder you have your executable is a root folder, will fail due to missing priveleges. Users can not run root progs, unless the permissions have been set to apply such operation. – George Vasiliou Feb 07 '17 at 14:49
  • it turns out that when i use "sudo nautilus" and launch my sublime_text.desktop then it works...and it does not work normally :( any help on permission issue?? – Suraj Mandal Feb 07 '17 at 15:08
  • Open nautilus with sudo, browse to the location of the executable , right click on executable, look for permissions tab, and apply execute to others. Maybe you need to do the same for the .desktop file. – George Vasiliou Feb 07 '17 at 15:12
  • aan....its already set to read and write for me – Suraj Mandal Feb 07 '17 at 15:15
  • There is read, write and execute. Three different flags. Go with command line (as root) and type `ls -all sublime*`. You must be seeing x flags in all the groups. – George Vasiliou Feb 07 '17 at 15:17
  • 'ls -all sublime_text' shows the following output '-rwxrwxrwx 1 cruelplatypus67 cruelplatypus67 5200392 Sep 23 15:43 sublime_text' – Suraj Mandal Feb 07 '17 at 15:20
  • @surajmandalcell OK, this is good - no permissions problem. What about the permissions of .desktop file? – George Vasiliou Feb 07 '17 at 15:26
  • -rwxrwxrwx 1 cruelplatypus67 cruelplatypus67 231 Feb 7 20:40 sublime_text.desktop – Suraj Mandal Feb 07 '17 at 15:29
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/53185/discussion-between-suraj-mandalcell-and-george-vasiliou). – Suraj Mandal Feb 07 '17 at 15:29