Whenever I start my BSPWM session, and regardless of how I start it (I have tested LightDM and Startx), I find that environment variables are somehow not being propagated as expected to X clients during that session.

I have checked the contents of /proc/$( pgrep bspwm )/environ, and it appears the BSPWM process itself does have the expected environment variables. However, once the X session is started, X clients (such as my terminal emulator) do not have the expected environment variables set.

This is quite a weird problem and I'm not sure how to go about debugging it. Is there any obvious configuration problem that I am overlooking?

Here is my very basic ~/.xinitrc script:


# Set a bunch of environment variables
. ~/.config/envrc

# Copy some useful elements from my distro's xinit script
. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh
. /etc/X11/xinit/xinitrc.d/xdg-user-dirs.sh
if test -r $HOME/.nvidia-settings-rc && type -p nvidia-settings > /dev/null
    nvidia-settings --load-config-only > /dev/null 2>&1 &

# Load Xresources for various programs
xrdb -I $HOME -merge ~/.Xresources

# Run my window manager
exec /usr/bin/bspwm "$@"

In case it's relevant, I am currently using Opensuse Tumbleweed, and I have not adjusted the default PAM configuration in any way. And, from what I remember, I have also had this problem on Debian under Herbstluftwm. So I don't think it's a BSPWM-specific or Suse-specific problem.

  • Do you start clients from bspwm, or in some other way? Are the clients child processes of bspwm (use e.g. pstree)?
    – dirkt
    Jan 30, 2021 at 19:01
  • 1
    @dirkt aha, I think you solved the mystery. BSPWM does not handle hotkeys; it uses SXHKD to do that. And I had reconfigured sxhkd to start as a Systemd user service, which does not inherit environment variables. I will leave this question open for a bit while I investigate further. I want to see if the problem exists under Herbstluftwm (which does handle its own hotkeys), or if it's just BSPWM/SXHKD-specific. Jan 30, 2021 at 19:08

1 Answer 1


The problem turned out to be that I was running Sxhkd (the hotkey daemon meant to accompany BSPWM) and Urxvtd as Systemd user services:

systemctl --user start \
    bspwm-panel.service \
    bspwm-sxhkd.service \
    redshift.service \

I changed my script to:

systemctl --user import-environment
systemctl --user start \
    bspwm-panel.service \
    bspwm-sxhkd.service \
    redshift.service \

and it now works correctly.

If you want to whitelist specific environment variables to be imported (e.g. PATH), you can write systemctl --user import-environment PATH DISPLAY FOO BAR ....

Thanks to @dirkt for figuring this out!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .