Replies: 2 comments 1 reply
-
|
Hey, If you set it in your PATH, you should be able to run I don't know how you launch niri but I'm using uwsm. If you install these dotfiles it adds this to what's basically the bottom of your When this executes, as far as I know it will inherit whatever your shell has available and Btw, I also have a satty config at https://github.com/nickjj/dotfiles/blob/master/.config/satty/config.toml which you may want to carry over if you like these preferences. In my niri config there's also As for zprofile vs zshrc. The main difference is zshrc will execute every time you open a new terminal session where as zprofile will only execute once when you login. I try to keep my zprofile loaded up with things that won't change often like defining a number of env vars and launching niri itself. You can also source your zprofile in your current terminal if you wanted to test something new without logging out and back in. Going back to how you launch niri, if you had |
Beta Was this translation helpful? Give feedback.
-
Yes I know this. I think the root of my problem is that Niri doesn't seem to "see" my full PATH, like you said.
Yes, running the script from a shell always works.
Yes I did copy your
I launch Niri via a display manager, ly.
Now you got me thinking about how a display manager actually starts a WM, and what the order for sourcing files like .zshrc and .zprofile is. I'll take a look into documentation for these. Thank you for the help! This isn't a big problem at all, I just prefer to write less code in my config files if possible. When there are dozens of shell scripts, typing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I liked your
dot-screenshotshell script, so I copied it to my own~/.local/bin. I binded it to a Mod+S keybind for Niri, same as you. However, the syntax I had to use inside~/.config/niri/config.kdlhad to be eitherspawn "~/.local/bin/dot-screenshot" "region"orspawn-sh ~/.local/bin/dot-screenshot region". I mean, I had to use the absolute path to the screenshot shellscript. I see you only have to usespawn "dot-screenshot" "region". I like short lines of code a lot more than long ones, so I'm curious how you were able to make it work.There are some differences between your configs and mine, I'll list them here:
Yours
export PATH="${HOME}/.local/bin:${PATH}"inside~/.zprofilespawn "dot-screenshot" "region"inside~/.config/niri/config.kdlMine
Initial
path=(~/.local/bin $path)inside~/.zshrc.spawn "~/.local/bin/dot-screenshot" "region"inside~/.config/niri/config.kdlThis uses the absolute path to the screenshot script, so of course it works.
First change
path=(~/.local/bin $path)inside~/.zshrcspawn "dot-screenshot" "region"inside~/.config/niri/config.kdlNot working.
Second change
path=(~/.local/bin $path), includeexport PATH="${HOME}/.local/bin:${PATH}"inside~/.zshrcspawn "dot-screenshot" "region"inside~/.config/niri/config.kdlNot working.
Third change
export PATH="${HOME}/.local/bin:${PATH}"orpath=(~/.local/bin $path)inside~/.zprofileinstead of~/.zshrcspawn "dot-screenshot" "region"inside~/.config/niri/config.kdlIt works!
Conclusion
So what I figured out is that I had to modify the
PATHenv var or thepatharray (pretty much the same thing) inside~/.zprofileinstead of~/.zshrc. I don't know why, but I had to. Normally, I like to keep every zsh config in~/.zshrc, I don't want to touch my~/.zprofilefile ever, because I usehttps://github.com/romkatv/zsh4humansand its documentation has this section:For the cases that didn't work for me (cases where I include
PATHcode inside .zshrc instead of .zprofile), I think possibly my~/.local/binwas somehow not in thePATH, so Niri couldn't find thedot-screenshotscript? I'm not entirely sure, because whenever I launch a terminal and runecho $PATH | tr ':' '\n' | grep '/home/sondhg/.local/bin', it does exist in thePATH(zsh is my login shell).I just want to ask if you ever had trouble with this kind of "calling a shell script from a WM" problem. I've just recently switched from a DE to a WM and started to learn how to write shell scripts, and this has been quite a headache for me.
Beta Was this translation helpful? Give feedback.
All reactions