You are not logged in.
In MX-Linux I want to add a folder to PATH and it works well in Terminal.
However I can't make Xfce understand it.
A command in a starter/launcher on the desktop or in the Panel can not work without entering full path.
So how do I add a folder to PATH in a way that can make it work in Xfce.?
Last edited by Jakob77 (2023-11-12 19:13:45)
Offline
Try creating a file in /etc/profile.d that adds to and exports the PATH variable:
PATH=$PATH:$HOME/mypath
export $PATH
During Xfce startup, it will process the file.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Try creating a file in /etc/profile.d that adds to and exports the PATH variable:
PATH=$PATH:$HOME/mypath export $PATH
During Xfce startup, it will process the file.
Thank you.
I created a file:
/etc/profile.d/setpath.sh
containing only these two lines:
PATH=$PATH:$HOME/bin
export $PATH
After boot up I see no change in PATH
Did you forget to give me a proper filename or what did I do wrong.? :-)
Offline
What shell are you using? This location will only work for the Bourne shell and derivatives (sh, bash, ksh) if you are checking through your terminal.
However, it should work for Xfce as it uses Bourne as part of its startup files. Try adding a launcher to the panel that runs:
echo $PATH | zenity --text-info -
(put it inside of a script and add that script as a launcher).
When you launch it, it will display the PATH that Xfce is using.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
I could not make the launcher work but if I use this line in Terminal:
echo $PATH | zenity --text-info -
this is how it looks:
$ echo $PATH | zenity --text-info -
Command 'zenity' not found, but can be installed with:
sudo apt install zenity
If I use full path in a Panel launcher to a script in ~/bin, and that script sends "echo @PATH >> PATH_logfile.txt" , I can read in that file that the PATH is amputated compared to the one configured in Terminal.
It looks like this:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
I believe the shell is Bash.
Last edited by Jakob77 (2023-05-05 15:00:25)
Offline
Greetings to y'all ...
A while back, I needed to prepend/append my system's global path. I accomplished this by editing (as root) the system-global /etc/environment file (note: Linux Mint -- YMMV).
Recently, I've begun to experiment with the RUST language. A found out that the installer added the ~/.cargo folder and its env script with the following content:
#!/bin/sh
# rustup shell setup
# affix colons on either side of $PATH to simplify matching
case ":${PATH}:" in
*:"$HOME/.cargo/bin":*)
;;
*)
# Prepending path in case a system-installed rustc needs to be overridden
export PATH="$HOME/.cargo/bin:$PATH"
;;
esac
Between my original tweak, and Rusts's installer, you may be able to figure out the specific workaround you want.
Cheers, m4a
Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support
Offline
I could not make the launcher work but if I use this line in Terminal:
echo $PATH | zenity --text-info -
this is how it looks:
$ echo $PATH | zenity --text-info - Command 'zenity' not found, but can be installed with: sudo apt install zenity
Can you install zenity (its a small package) and try again?
I believe the shell is Bash.
echo $SHELL
I tested this in my MXLinux vm and it worked for me.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
ToZ
When I try to install zenity I get this output:
$ sudo apt install zenity
Indlæser pakkelisterne... Færdig
Opbygger afhængighedstræ... Færdig
Læser tilstandsoplysninger... Færdig
Pakken zenity er ikke tilgængelig, men der refereres til den af en
anden pakke. Det kan betyde at pakken mangler, er blevet forældet
eller kun er tilgængelig fra en anden kilde
E: Pakken »zenity« har ingen installationskandidat
Not available, might be too old, has no installation candidate...
The other one works here also:
$ echo $SHELL
/bin/bash
It brings hope to the subject that you also have a MX distro. :-)
Offline
I got this suggestion from MX-forum:
Edit this file:
/etc/xdg/xfce4/xintrc
- at the top of that file, just under #!/bin/sh
add this :
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
After reboot the users bin folder (if it exists) will be the first in PATH
Can you verify the solution as being compatible with Xfce.?
Offline
Possibly, but whenever the package that contains that file is updated, your changes will be lost (xfce4-session?).
The other option is to copy this file to ~/.config/xfce4/ and edit it there. This should override the one in /etc.
But strange that it didn't work in /etc/profile.d like it did for me.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Possibly, but whenever the package that contains that file is updated, your changes will be lost (xfce4-session?).
The other option is to copy this file to ~/.config/xfce4/ and edit it there. This should override the one in /etc.
But strange that it didn't work in /etc/profile.d like it did for me.
Thank you.
Move /etc/xdg/xfce4/xintrc to ~/.config/xfce4/
What do you mean by "override". Will it prevent updates.?
What name did you give the file you created in /etc/profile.d ?
Last edited by Jakob77 (2023-05-06 07:25:06)
Offline
Move /etc/xdg/xfce4/xintrc to ~/.config/xfce4/
What do you mean by "override". Will it prevent updates.?
No it won't prevent updates. That file will be used instead of the one at /etc/xdg/xfce4 so that if there is an update, your changes won't be lost.
What name did you give the file you created in /etc/profile.d ?
99-path.sh
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
ToZ
I have now tested the filename "99-path.sh", and on my computer that also doesn't work.
You are right it is strange. Maybe it works for you because you run a Live session or booted up in system d, I don't know.
What ever modification we end up with we want it to be compatible with Xfce.
Are we coming closer to the point where you can confirm our modification as being that.
Or do you perhaps see a growing line of possible bugs showing up.?
Offline
FWIW: MX uses yad (for a lot, actually) instead of zenity.
What ever modification we end up with we want it to be compatible with Xfce.
Not sure who "we" are in your statement, but that's not really true for MX, as this thread itself has demonstrated.
MX-23 (based on Debian Stable) with our flagship Xfce 4.18.
Offline
What ever modification we end up with we want it to be compatible with Xfce.
Not sure who "we" are in your statement, but that's not really true for MX, as this thread itself has demonstrated.
I am not sure what that means at all.
"We" normally just means more than one, and that is also the meaning here.
And this subject shows without any doubt that we want the modification to be compatible with Xfce (the main desktop for MX).
I don't see why we have to be concerned about a few crazy MX users who doesn't want MX mods to be compatible with Xfce.
If you are here to help their case I think you ought to find another subject for it.
Offline
ToZ
I have now tested the filename "99-path.sh", and on my computer that also doesn't work.
You are right it is strange. Maybe it works for you because you run a Live session or booted up in system d, I don't know.What ever modification we end up with we want it to be compatible with Xfce.
Are we coming closer to the point where you can confirm our modification as being that.
Or do you perhaps see a growing line of possible bugs showing up.?
Been doing some testing. profile.d doesn't work consistently in MXLinux. Tried in a second VM and it wouldn't work. Here is what did work:
Create the file ~/.config/xfce4/xinitrc with the following content:
#!/bin/sh
PATH=$PATH:$HOME/bin
exec /etc/xdg/xfce4/xinitrc
Make the file executable:
chmod +x ~/.config/xfce4/xinitrc
Log out and back in again
This xinitrc will override the system one, but it will only set the additional PATH entry then call the system script. This way, if the system script changes during an update, there will be no impact.
FWIW: MX uses yad (for a lot, actually) instead of zenity.
In that case, the script above could read:
echo $PATH | yad --text-info -
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Here is what did work:
Create the file ~/.config/xfce4/xinitrc with the following content:
#!/bin/sh PATH=$PATH:$HOME/bin exec /etc/xdg/xfce4/xinitrc
Make the file executable:
chmod +x ~/.config/xfce4/xinitrc
Log out and back in again
This xinitrc will override the system one, but it will only set the additional PATH entry then call the system script. This way, if the system script changes during an update, there will be no impact.
Thank you very much. That is great. :-)
I had to reboot, but I have tested it with good results in MX 21.3.
The only downside I see compared to the other solution
https://forum.xfce.org/viewtopic.php?pid=71816#p71816
is that it doesn't work for all users. It only works for the specific user that received the modification.
But of course that won't be a problem if it is build in MX install, so it automatically comes along when a new user is created.
Last edited by Jakob77 (2023-05-08 16:06:49)
Offline
ToZ
I want to thank you again and ask a little more about
~/.config/xfce4/xinitrc
#!/bin/sh
PATH=$PATH:$HOME/bin
exec /etc/xdg/xfce4/xinitrc
I am not very good at scripting and I am not familiar with the shell so I want to ask before I do something too stupit to the file.
Can I for instance add lines like theese to the file so ~/bin only will be added to PATH if the folder exists:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
and then afterwards add more folders.?
So it could end up looking something like this:
#!/bin/sh
# set Xfce PATH so it includes user's private bin first in line if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# add folder "~/scripts" in the end of Xfce PATH
PATH=$PATH:$HOME/scripts
exec /etc/xdg/xfce4/xinitrc
Offline
Absolutely, and that makes good sense. Only add the folder to the path if it exists. You can do the same with the scripts folder.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
The advice about xinitrc is really great. I can't stop being happy about it.
The user can edit PATH by and for himself, it doesn't take sudo, and it works perfectly. :-)
For me the problem is solved so well that I just have to take it a step further and try to make it default for MX Xfce.
In that context I would very much like to ask if xinitrc is only for configuring PATH, and if not what more magic it can do.?
Offline
In that context I would very much like to ask if xinitrc is only for configuring PATH, and if not what more magic it can do.?
With xinitrc, you can set any environment variables or even run programs if you want to. The latter is a little redundant for Xfce since it has its own application autostart facility.
Last edited by ToZ (2023-11-12 10:39:53)
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Jakob77 wrote:In that context I would very much like to ask if xinitrc is only for configuring PATH, and if not what more magic it can do.?
With .xinitrc, you can set any environment variables or even run programs if you want to. The latter is a little redundant for Xfce since it has its own application autostart facility.
Thank you very much. It gives me more good options to think about. :-)
I have had problems making environment variables work so I used a folder instead. If the folder exist it means one thing, and if not it means something else. But now it looks like I have a good option to do it in a more regular way.
I also see possibilities in autostart because it gives me an option to restore the autostart commands just by copy a file.
(Off topic: It strikes me that xinitrc works a lot like autoexec.bat in good old DOS, and that is actually a file I have been missing for many years.)
You put a dot in front of x in .xinitrc
I have not seen that before. Is it something to be concerned about.?
Offline
You put a dot in front of x in .xinitrc
I have not seen that before. Is it something to be concerned about.?
Sorry that was a typo. There is an XWindow version of xinitrc that can be put in your home directory that contains a dot.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
It is completely okay. It just almost never happens, so I had to make sure I wasn't missing anything important. :-)
Offline
[ Generated in 0.032 seconds, 7 queries executed - Memory usage: 655.46 KiB (Peak: 688.3 KiB) ]