Been using manjaro w. i3 for a while and now transitioned to Endeavour, also w. i3 - one step closer to perfection One strange thing though, in my i3-config file, I can’t execute scripts. I can execute them just fine from terminal.
simple example - launching a webbrowser this way works fine:
Yes that does work, tried it but forgot to write it! However, some of the scripts calls other scripts within them, and those scripts are then not useable either. I’d like to avoid having absolute paths as a standard in my scripts if I can avoid it
Why? That’s the simplest and most elegant solution here.
If you are not going to use absolute paths, you’ll need to define your PATH environment variable in the script. It does not source your .bashrc. Or you can add source ~/.bashrc to the beginning of your script, which is a rather clumsy solution.
Well I came from Manjaro, where the $HOME/bin was possible to execute through i3. So I assumed that was a standard thing. So when I go to Endeavour, I assume that $HOME/bin is also in he PATH (which it is, in my .zshrc and .bashrc files). It doesn’t seem unelegant to me that there is a folder in the $HOME dir where you can put scripts and expect them to be executable by something like i3, (without admin rights, of course), is it? Seems elegant to me, but if you can tell me why that’s a bad idea I’d be happy to learn something new! What if the directory structure changes? Isn’t the whole idea with a $PATH that you tell it where your executables are, exactly to get rid of absolute paths that are fragile because they can change?
What I’m mostly interested it, though, is understand why I could execute scripts in i3 on manjaro linux and not on endeavour. Where is i3 sourcing the $PATH from that is different from manjaro linux ?
Because on Manjaro you probably set the PATH variable elsewhere. Where? I don’t know, it’s your system, you should know that. Probably in .bash_profile?
Thank you so much, I’m learning something from this. Could you tell me, if you have the time, how you backtracked this? what was your line of reasoning to get at the conclusion? I appreciate the answer and I would like even more to get better at troubleshooting these things myself!
/etc/profile.d was my suspicion before I even looked (because that is how I would set it). It was just a matter of taking a peek to check if I was right.
/etc/profile.d is a great place to set environment variables because it will honor a script if you put it there. This means you don’t have to blatantly set an environment variable like you would in /etc/environment, instead you can set up something conditional. I recently added something for Garuda Linux Gnome, where if the user launches a Wayland session it will set a couple environment variables for them but if they are using X11 it will not (https://gitlab.com/garuda-linux/themes-and-settings/settings/garuda-gnome-settings/-/blob/master/etc/profile.d/environment.sh), so it was somewhat fresh in my head already.
Quite strange actually. I have another system running Ubuntu which uses Xfce with i3wm as window manager, in my i3wm config I just use the command I need and if it’s in my user’s path it will just open. Maybe try adding the PATH to your scripts?