How to set PATH for Dolphin servicemenu

Konstantin Kharlamov hi-angel at yandex.ru
Fri May 12 09:35:20 BST 2023


Although I'm not aware of a way to set an env. variable as an option field in
desktop file, however you very well can set it as part of the `Exec=` line if
you use `env` as a binary.

For example, this is a snippet from the .desktop file I made for my ex-gf to
launch the game Heroes Ⅲ: WOG with the variables:

 Exec=env INTEL_DEBUG=noccs LANG=ru_RU.UTF-8 gamescope -W 1366 -H 768 -fU
-- wine h3wog.exe

So you can see I set INTEL_DEBUG and LANG variables here

On Fri, 2023-05-12 at 10:28 +0200, Zener wrote:
> Anyway... Is not possibile to define a parameter $PATH directly in the .
> desktop file?
> 
> e.g. :
> PATH=`~/bin
> exec=$PATH/command
> 
> I tried as above but that syntax doesn't work.
> 
> Il gio 11 mag 2023, 23:26 Konstantin Kharlamov <hi-angel at yandex.ru> ha
> scritto:
> > In this case I'm not sure, perhaps anyone else has something to say about
> > that…
> > 
> > Though, can't you just write a full path inside your .desktop file?
> > 
> > On Thu, 2023-05-11 at 22:05 +0200, Zener wrote:
> > > It still doesn't work...again After reboot...
> > > Is wayland, Dolphin or what the issue?!?
> > > 
> > > Il gio 11 mag 2023, 21:47 Konstantin Kharlamov <hi-angel at yandex.ru> ha
> > > scritto:
> > > > Please, use "reply all" in the mail client so that discussion gets
> > > > duplicated on the list and someone else may come up with ideas and what
> > > > not.
> > > > 
> > > > So, it's, interesting: actually, I just realized that both
> > > > /etc/environment and /etc/profile as well as ~/.profile are all read by
> > > > shells. I never thought about that.
> > > > 
> > > > So, if you modified your ~/.profile file, I would presume it should work
> > > > (I never tried though, just judging by what I just read on the topic),
> > > > however I think you need to restart DE (that is, log out and log back
> > > > in) for these changes to start working. That is because your DE would
> > > > need to get launched with these env. variables, and then it would launch
> > > > ".desktop" file apps using the environment it got.
> > > > 
> > > > On Thu, 2023-05-11 at 20:57 +0200, Zener wrote:
> > > > > Ok... I've used ~/.profile (because it's for a personal config) but It
> > > > > doesn't work.
> > > > > What's a correct syntax?
> > > > > 
> > > > > Il gio 11 mag 2023, 20:52 Konstantin Kharlamov <hi-angel at yandex.ru> ha
> > > > > scritto:
> > > > > > On Thu, 2023-05-11 at 20:28 +0200, Zener wrote:
> > > > > > > Hi.
> > > > > > > 
> > > > > > > I use Dolphin filemanager on a gnome-session on wayland - Arch
> > > > > > Linux.
> > > > > > > 
> > > > > > > I've set the correct PATH on .bashrc, in fact from terminal my
> > > > > > exec 
> > > > > > > files work but not to from a .desktop file in servicemenu of
> > > > > > Dolphin.
> > > > > > > 
> > > > > > > How can i add the correct PATH on Dolphin?
> > > > > > > 
> > > > > > > Regards.
> > > > > > > 
> > > > > > 
> > > > > > Right, because `.bashrc` is only read by bash. When you launch an
> > > > > > app from a desktop file, there's no bash involved (unless of course
> > > > > > the Exec= call inside .desktop file calls bash explicitly).
> > > > > > 
> > > > > > Use `/etc/profile` file instead, the $PATH is usually set there.
> > > > 
> > > > 
> > 
> > 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-devel/attachments/20230512/e13d52c9/attachment.htm>


More information about the kde-devel mailing list