1

I'm using archlinux, dwm and dwmblocks. At startup dwmblocks shows only the icons of the blocks', without loading the scripts output. If I run

$ killall dwmblocks

and restart

$ dwmblocks &

it loads all required modules flawlessly.

For me, as a nonprofessional, it seems that the $PATH is not read before startx. So in .xinitrc I've sourced the bashrc (where the $PATH is extended) with

source $HOME/.bashrc &

before running dwmblocks &.

Also I've tried to delay the execution of dwmblocks by placing sleep 2 a line above. This doesn't help either.

Searching for the Xorg log-files wasn't a success eather. I've found them as indicated by archwiki, however the file dowsen't seem to give any clue about dwmblocks.

4
  • Why are you setting the path in .bashrc instead of .profile? That's probably the problem. Does it work as expected if you put your PATH definitions in ~/.profile, then log out and log back in? Also, how are you starting dwmblocks? – terdon Nov 12 '20 at 13:09
  • @terdon thank you for helping. I've added the paths to .profile. It didn't work. I'm startingdwmblocks in .xinitrc with dwmblocks & command. – alex Nov 12 '20 at 13:33
  • Hmm. OK, I'm not sure that .xinitrc is read by bash, so source (which is a non=-portable, bash thing) might not be working. Try using . /home/alex/.bashrc (use . instead of source and use the full path) in your .xinitrc, does that help? – terdon Nov 12 '20 at 13:44
  • @terdon Thank you for the good advice. With . /home/alex/.profile & in .xinitrc it worked -- source ... doesen't work (do you have an idea why). Please feel free to add it as answer and I will confirm and upvote it happily (-: – alex Nov 12 '20 at 14:25
1

The command source is not portable. That is a bash-specific (possibly also some other shells) alias to the standard POSIX shell command .. So, it looks like your .profile is being read by something other than bash which means you should use . and not source.

Also, you can't be sure that $HOME will be set (it may well be in this case, but it might not) so use an absolute path instead, to be on the safe side. Finally, you don't need to send that to the background, it will just read the file and exit. Putting all that together, try using this instead:

. /home/alex/.bashrc

Also note that environment variables are better placed in ~/.profile and not ~/.bashrc since ~/.bashrc is only read by the bash shell and only for interactive, non-login shell sessions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.