LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   .desktop files ignoring local bin (https://www.linuxquestions.org/questions/debian-26/desktop-files-ignoring-local-bin-4175503838/)

hpp3 05-03-2014 04:37 PM

.desktop files ignoring local bin
 
Hello, having a problem with .desktop entries not being able to see executables in my local bin folder.
FYI: I'm on Debian "Testing" 64-bit, Xfce 4.10.

It's happening with various programs, but just for testing purposes, I compiled a simple form with Lazarus, called it "testthis" and put it in ~/.local/bin.
I have $HOME/.local/bin in my $PATH.
If I type the name of the program in a terminal, it runs.
If I double-click the executable from the file manager, it runs.

BUT, if I have it called via a .desktop file from the main menu, it doesn't run.
If I type in a terminal "exo-open ~/.local/share/applications/test.desktop" it runs.
If I put the .desktop entry on my Desktop, I double-click it and it pops up a message box titled "Launch error" with this error message:
Quote:

Failed to run "testthis.desktop"
Failed to execute child process "testthis" (No such file or directory)
Now, if I have just the name of the program in the .desktop file:
Code:

Exec=testthis
then it gives the error.
If I put the full path in:
Code:

Exec=/home/hpp3/.local/bin/testthis
then it runs fine.
Also, if I run a script from the .desktop file that runs a program in my local bin just by name, it doesn't work either.

The Freedesktop spec says that the $PATH is searched:
http://standards.freedesktop.org/des...exec-variables
Quote:

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.
What's going on here?


P.S. I have tried changing the execute permissions on the desktop file; doesn't do anything

ondoho 05-04-2014 04:21 AM

why are you using $HOME/.local/bin instead of $HOME/bin?

i don't even have a folder of that name, neither is it in my $PATH.

RockDoctor 05-04-2014 08:24 AM

I've also encountered the "desktop file needs full path to program" situation. My solution is to just include the full path in the desktop file.

ondoho: I've got a $HOME/bin folder that I created where I keep various personal executables. And, like you, I never created (nor even thought of creating a $HOME/.local/bin folder. However, looking at my $PATH, I see that Fedora Rawhide has both $HOME/.local/bin and $HOME/bin.

hpp3 05-04-2014 09:42 AM

I created $HOME/.local/bin because there was already a $HOME/.local and I found advice to put user-created .desktop files in $HOME/.local/share/applications and I thought "How clever, a root file structure inside my home dir... neat!!", so I started installing compiled stuff that I wanted to keep all to myself in $HOME/.local instead of /usr or /opt. Some things complain and require some tweaks, but it's mostly worked out pretty well.

hpp3 05-04-2014 09:55 AM

So, I found the problem.

Apparently, my Xfce was searching down a different $PATH than what was being set by all the usual suspects. As a Litmus test, I removed the "/usr/local/games:/usr/games" section from PATH everywhere I could find it. But every time I rebooted or did the logout/login dance, it was still there. Something was re-setting my path, but I couldn't find it. What was doing this, and why? Hours of head-scratching and a thousand internet searches later, and I had my answer:
http://ljwo.wordpress.com/2014/02/02...n-wheezy-xfce/
Quote:

Yes, you may not believe it, but the developers of lightdm hard–coded the PATH in the c–files of the manager. See for yourself here and here. So you change it in /etc/login.defs, and then comes lightdm and runs you over. WTF?!?
My reaction exactly. LightDM was changing my $PATH? and it's hard-coded?!? O_o Geez, some people's kids...
So, I followed the advice at that post and created a .xinitrc with my chose $PATH set and rebooted.
No dice.
A few more internet searches later and I had the right answer:
http://unix.stackexchange.com/a/81254
So, apparently ~/.xinitrc is only parsed when using Xinit or startx, like when you don't use a login or session manager to run your desktop environment. I have always used a login manager, so the solution was to do the same in ~/.xsession.
Bingo. My $PATH is set as I like it, and all my locally installed apps fire up just fine.


All times are GMT -5. The time now is 12:14 PM.