I am creating .desktop
files for use in the Unity Launcher.
I have my own location in my home directory where I put my executables (~/usr/bin/
) which is correctly added to my PATH
environment variable in my .pam_environment
file as specified in the relevant Ubuntu documentation.
This is the contents of my .pam_environment
file:
LANGUAGE=en_AU:en_GB:en
LANG=en_AU.UTF-8
LC_NUMERIC=en_AU.UTF-8
LC_TIME=en_AU.UTF-8
LC_MONETARY=en_AU.UTF-8
LC_PAPER=en_AU.UTF-8
LC_NAME=en_AU.UTF-8
LC_ADDRESS=en_AU.UTF-8
LC_TELEPHONE=en_AU.UTF-8
LC_MEASUREMENT=en_AU.UTF-8
LC_IDENTIFICATION=en_AU.UTF-8
PATH DEFAULT=${PATH}:~/usr/bin/
Which results in my PATH
variable being as follows:
ben@ben-HPdv6:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:~/usr/bin/:~/usr/bin/
I know it is appended twice, but anything in the .pam_environment
file seems to get added twice no matter what when using the correct syntax recommended in that Ubuntu Documentation I have referenced.
This is one example of the problem (it happens with all cases). I have a script (called eclipse
) in ~/usr/bin/
which runs Eclipse IDE.
I can open any terminal and simply type eclipse
and it runs fine like you would expect.
But when using the following .desktop
file:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=Eclipse - Juno (4.2)
Icon=/home/ben/.icons/eclipse.svg
Exec=eclipse
I get the error:
But when I change the Exec=
line to:
Exec=/home/ben/usr/bin/eclipse
it works perfectly.
The Official Unity Launchers and Desktop files documentation suggests that this should work:
Exec is the path to the executable file. The full path to the executable file must be used only in case it isn't in any of the paths specified in the $PATH variable. For example, any files that are inside the path /usr/bin don't need to have their full path specified in the Exec field, but only their filename.
Any suggestions on what is happening?