Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-07-11 00:24:05

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

[Solved] adding to environment variable PATH for all of Xfce

i'm sure i have asked this before but i cannot find it.

i want to change environment variable PATH when Xfce starts up to add another bin directory to PATH so that anywhere commands are run it can look in that directory.  i want every process to inherit this new PATH.

because of many Ubuntu packages putting files in /usr/local and my own local files rebuilding its bin subdirectory from scratch, i have moved local stuff from /usr/local to the created name /usr/host (so i am adding /usr/host/bin and /usr/host/sbin to PATH) to make it easier to do.  but that means adding those subdirectories to PATH everywhere (that i want to run my own commands or override an existing with the /usr/host subdirectories being up front).

i recall there was some script being run to start Xfce.  but, i cannot find such a thing.  does anyone know where this happens?

Last edited by Skaperen (2019-07-11 20:39:15)

Offline

#2 2019-07-11 01:38:29

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: [Solved] adding to environment variable PATH for all of Xfce

Are you using bash? If so, putting your

export PATH=$PATH:/directory 

command into ~/.bashrc might be a good idea.

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#3 2019-07-11 02:54:38

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: [Solved] adding to environment variable PATH for all of Xfce

that only effects the terminal bash sessions, not the Xfce processes.  i already have that in my big 600+ line .bashrc script.

Offline

#4 2019-07-11 03:04:54

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: [Solved] adding to environment variable PATH for all of Xfce

some lines from my ~/.bashrc file:

[[ -n "${USER}" ]] || USER=$(exec whoami)
export USER
case "${USER}" in
    (root|admin|admini)
        suffix=( {cmd,bin,pgm} )
        ;;
    (*)
        suffix=( {cmd,bin,pgm,games,scripts} )
        ;;
esac
path=""
prefix=( {${HOME}/,/usr{/host/,/local/,/},/}{s,.,} )
for p in "${prefix[@]}";do
    for s in "${suffix[@]}";do
        if [[ -d "$p$s" && -x "$p$s" ]];then
            path="$path:$p$s"
        fi
    done
done
export PATH="${path:1}"

Offline

#5 2019-07-11 15:22:24

ctac
Member
Registered: 2017-05-08
Posts: 57

Re: [Solved] adding to environment variable PATH for all of Xfce

Take a look at this thread .
Or man 5 Xsession.

Offline

#6 2019-07-11 20:38:15

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: [Solved] adding to environment variable PATH for all of Xfce

ctac wrote:

Take a look at this thread .
Or man 5 Xsession.

thanks!  it looks like /etc/X11/Xsession is the place.  several other environment variables are already set there.

Offline

#7 2019-07-12 15:26:49

mint4all
Member
From: off the map
Registered: 2018-08-21
Posts: 276

Re: [Solved] adding to environment variable PATH for all of Xfce

Greetings!

Though you've [Solved} your spec already, the following solution might come in handy at some point, or might help someone else. Based on a suggestion i read a while ago (can't recall where) I've added (as root) my own system-wide/global variables to the /etc/environment file. Worked like a charm for me.

Cheers, m4a


Linux Mint 21.3 -- xfce 4.18 ... Apple iMAC -- Lenovo, Dell, HP Desktops and Laptops -- Family & Community Support

Offline

#8 2019-07-13 06:33:21

ctac
Member
Registered: 2017-05-08
Posts: 57

Re: [Solved] adding to environment variable PATH for all of Xfce

mint4all wrote:

Based on a suggestion i read a while ago (can't recall where) I've added (as root) my own system-wide/global variables to the /etc/environment file. Worked like a charm for me.

I don't test your suggestion but it seem really more easy. smile
Tanks.

Offline

#9 2019-07-13 20:13:14

Skaperen
Member
From: right by Jesus, our Saviour
Registered: 2013-06-15
Posts: 862

Re: [Solved] adding to environment variable PATH for all of Xfce

yeah /etc/environment seems sensible.  i'll add mine there, too.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 546.97 KiB (Peak: 547.81 KiB) ]