This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KDE 4 seems to ignore PATH order

Tags: None
(comma "," separated)
Erik
Registered Member
Posts
24
Karma
0
OS

KDE 4 seems to ignore PATH order

Thu Mar 18, 2010 9:48 pm
Greetings, fellow forum members!

I have encountered interesting issue while playing with kgtk -- it is a wrapper to use KDE open/save dialogs within GTK and QT4 applications.
I install kgtk, and link the wrapper to /usr/local/bin/program_name as suggested in the manual, e.g.
Code: Select all
cd /usr/local/bin/
ln -s /usr/bin/kgtk-wrapper firefox

My PATH is:
Code: Select all
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.3.4:/usr/qt/3/bin:/usr/games/bin

So /usr/local/bin/firefox should now start first. It works if I start firefox from a terminal -- I get KDE4 open/save dialogs.
However, if I start firefox via KDE -- Alt+F2 dialog, Kickoff-menu or desktop icon, I still get GTK menus. A workaround is to edit firefox.desktop to /usr/local/bin/firefox, but it can't be the right way.

So the question is -- where does KDE4 store its path and why it overrides mine? How do I make /usr/local/bin/ my first path in KDE4?

It is a 32-bit system with KDE compiled witout kdeprefix flag.


Erik, proud to be a member of KDE forums since the very beginning.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Where do you set $PATH? It needs to be done before startkde is run. Alternately, you can use a script in $(kde4-config --localprefix)/env/ to set it appropriately...


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Erik
Registered Member
Posts
24
Karma
0
OS
I've tried just that, no luck.
It seems to me that it is xdg-open who opens wrong path -- it is xdg-open who interprets .desktop files. Have to read how do I configure its behavior.

EDIT: Yes, the root of the problem is xdg-open: if I have "Exec=firefox %U" in firefox.desktop file and execute "xdg-open ./firefox.desktop" it starts /usr/bin/firefox and not /usr/local/bin/firefox.

Of course, I can create .desktop entries in ~/.local/share/applications/ and place "Exec=/usr/local/bin/program" for each program I intend to launch via /usr/local/bin, but it is to bothersome. There should be another way to configure xdg-open-


Erik, proud to be a member of KDE forums since the very beginning.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Interestingly, I can't reproduce although my situation is slightly different....
Self compiled trunk, used xdg-open to run System Settings.

Code: Select all
xdg-open /usr/share/applications/kde4/systemsettings.desktop


The application opened wasn't /usr/bin/systemsettings but /opt/trunk-kde/kde/bin/systemsettings as expected ( ie. PATH was respected )

When I added an executable script named "firefox" to /opt/trunk-kde/kde/bin/ that worked too. You may wish to check that your script is executable...


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Erik
Registered Member
Posts
24
Karma
0
OS

Re: KDE 4 seems to ignore PATH order

Fri Mar 19, 2010 10:16 pm
Steps to reproduce for me:
Code: Select all
#ln -s /usr/bin/konqueror /usr/local/bin/firefox

Create firefox.desktop with following:
Code: Select all
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Mozilla Firefox
Comment=Web Browser
Exec=firefox %U
Icon=firefox-icon
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;
Categories=Network;WebBrowser;
StartupNotify=true

"firefox" from terminal starts Konqueror, "xdg-open firefox.desktop" starts Firefox (it asks whether I trust the script to be executed on first run and sets it to executable if I agree).
"kfmclient exec mozilla-firefox-3.6.desktop" starts Firefox as well.

If it works for you correct then it might be gentoo-related issue.


Erik, proud to be a member of KDE forums since the very beginning.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: KDE 4 seems to ignore PATH order

Sat Mar 20, 2010 12:48 am
It may be possible that the XDG standard requires that symlinks are ignored. I used actual executable files... additionally, did you logoff after placing the file in ~/.kde4/env? it is needed to take any changes in that directory into effect.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jsatt
Registered Member
Posts
5
Karma
0
OS
I am experiencing the same issue as Erik in Kubuntu 10.04 as well as openSuSE 11.2 for the short time i had it installed, both KDE 4.4.4. The only difference is that my specific case is I need stuff to run from $HOME/bin.

I have tried adding $HOME/bin to the beginning of my path in ~/.profile, ~/.bashrc, ~/.kde/env/path.sh, and /etc/environment. ALL of them run executables from $HOME/bin when in a terminal, as it should, and ALL seem to ignore that PATH from ANYWHERE within kde or xdg-open.

Anyone have any further ideas on a fix?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Is the script you placed in ~/.kde/env/path.sh executable? Also, please verify using the output of "kde4-config --localprefix" that ~/.kde is that correct directory.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jsatt
Registered Member
Posts
5
Karma
0
OS
Yes it is executable, and kde-config --localprefix does return ~/.kde
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please check the content of the *.desktop files whose behaviour you are trying to modify. They may reference the executables in question by unexpected names or directly on the file system.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jsatt
Registered Member
Posts
5
Karma
0
OS
This is the entire contents of the .desktop
Code: Select all
[Desktop Entry]
Comment[en_US]=Browse the World Wide Web
Comment=Browse the World Wide Web
Exec=firefox %u
GenericName[en_US]=Web Browser
GenericName=Web Browser
Icon=/usr/share/pixmaps/firefox.png
MimeType=text/html;image/png;image/jpeg;image/gif;application/xml;application/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;
Name[en_US]=Firefox Web Browser
Name=Firefox Web Browser
NoDisplay=false
Path=
StartupNotify=true
StartupWMClass=Firefox
Terminal=false
TerminalOptions=
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
X-MultipleArgs=false
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Unfortunately I do not know why this issue is occurring.. can you try placing a script in ~/.kde4/Autostart which echo's $PATH?

You will then be able to see this output in ~/.xsession-errors.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jsatt
Registered Member
Posts
5
Karma
0
OS
The PATH echoed to .xsession-errors is identical to what is echoed from a normal terminal with $HOME/bin listed first.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: KDE 4 seems to ignore PATH order

Fri Jun 25, 2010 10:00 pm
Unfortunately I don't know why this occurs. Please file a bug report at bugs.kde.org.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
jsatt
Registered Member
Posts
5
Karma
0
OS
Just in case anyone else cares to follow it... https://bugs.kde.org/show_bug.cgi?id=242834


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]