You are not logged in.

#1 2021-02-21 14:08:24

neopium
Member
Registered: 2019-05-02
Posts: 85

[SOLVED] Issue with setting environment variables in bspwm

Hi,

I'm having trouble running Intellij Idea, a Java-based application. It was running just fine a few months ago, but when I tried to launch it today, the screen was grey.

This is due to Java not properly reparenting windows on WM it doesn't know (I use BSPWM).

This issue is described in the Arch Wiki.

To solve the issue, you just need to add environment variables in the proper files.

- For jre7-openjdk or jre8-openjdk, append the line export _JAVA_AWT_WM_NONREPARENTING=1 in /etc/profile.d/jre.sh. Then, source the file /etc/profile.d/jre.sh or log out and log back in.
- For last version of JDK append line export AWT_TOOLKIT=MToolkit in ~/.xinitrc before exec window manager.

In order to know which one was relevant to solve my issue, I first tried to export the variables manually. Exporting the _JAVA_AWT_WM_NONREPARENTING variable in a terminal and launching Intellij from the same terminal actually works, while manually exporting the AWT_TOOLKIT variable does not. This is strange, as I run Java 11.

Anyway, this is the variable that works so I went on and changed the /etc/profile.d/jre.sh and rebooted the machine.

(As an side remark, I'm not comfortable editing a file that says "do not change"... Won't it be overwritten during a future update?)

# Do not change this unless you want to completely by-pass Arch Linux' way
# of handling Java versions and vendors. Instead, please use script `archlinux-java`
export PATH=${PATH}:/usr/lib/jvm/default/bin
export _JAVA_AWT_WM_NONREPARENTING=1

However, this does not seem to work. On a new terminal, typing the following command returns an empty line.

echo $_JAVA_AWT_WM_NONREPARENTING

I guess the /etc/profile.d/jre.sh file is not executed at startup, which is why the variable is not set.

I use LightDM, and it automatically logs my user in upon startup, so I looked at /etc/lightdm/Xsession:

[...]
# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
    if [ -f "$file" ]; then
        echo "Loading profile from $file";
        . "$file"
    fi
done
[...]

It seems LightDM does run anything under /etc/profile.d/.

But even when I add the `export _JAVA_AWT_WM_NONREPARENTING=1` command in my $HOME/.profile file, the variable is not set.

There seems to be something wrong in the way my session is started and how configuration files are executed. Could you please help me figure it out?

Last edited by neopium (2021-02-21 21:09:26)

Offline

#2 2021-02-21 14:41:47

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

Indeed don't use a distro controlled file to add environment variables.
Instead add some /etc/profile.d/mystuff.sh and the export there. Make sure the file is set 644 (readable by you)
Files in /etc/profile.d are supposed to be sourced by /etc/profile, so ensure that file wasn't compromised and contains

# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
        for profile in /etc/profile.d/*.sh; do
                test -r "$profile" && . "$profile"
        done
        unset profile
fi

Online

#3 2021-02-21 15:07:40

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

Indeed don't use a distro controlled file to add environment variables.
Instead add some /etc/profile.d/mystuff.sh and the export there. Make sure the file is set 644 (readable by you)

Ok, I just did that. I created a new /etc/profile.d/java_reparenting.sh with only the variable export command.

Maybe the Wiki should be updated, by the way.

Files in /etc/profile.d are supposed to be sourced by /etc/profile, so ensure that file wasn't compromised and contains [...]

I checked and /etc/profile contains those lines.

I rebooted and typed:

[ben@Solgaleo ~]$ echo $_JAVA_AWT_WM_NONREPARENTING

[ben@Solgaleo ~]$ source /etc/profile
[ben@Solgaleo ~]$ echo $_JAVA_AWT_WM_NONREPARENTING
1

This means the /etc/profile works, but it's not called by LightDM. How do I trace back the startup sequence to know what is called and what is not ?

Offline

#4 2021-02-21 15:15:42

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [SOLVED] Issue with setting environment variables in bspwm

Check the output of

grep -v ^# /etc/lightdm/lightdm.conf

contains

[Seat:*]
session-wrapper=/etc/lightdm/Xsession

If it does post the contents of /etc/lightdm/Xsession.

Offline

#5 2021-02-21 15:20:07

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

It does :

[ben@Solgaleo ~]$ grep -v ^# /etc/lightdm/lightdm.conf
[LightDM]
run-directory=/run/lightdm

greeter-setup-script = /usr/bin/numlockx on
[Seat:*]
xserver-command=X -bs -core
session-wrapper=/etc/lightdm/Xsession
autologin-user=ben
autologin-user-timeout=0

[XDMCPServer]

[VNCServer]

My full Xsession file is:

#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
    if [ -f "$file" ]; then
        echo "Loading profile from $file";
        . "$file"
    fi
done

# Load resources
for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
    if [ -f "$file" ]; then
        echo "Loading resource: $file"
        xrdb -merge "$file"
    fi
done

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
    if [ -f "$file" ]; then
        echo "Loading keymap: $file"
        setxkbmap `cat "$file"`
        XKB_IN_USE=yes
    fi
done

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
    for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
        if [ -f "$file" ]; then
           echo "Loading modmap: $file"
           xmodmap "$file"
        fi
    done
fi

unset XKB_IN_USE

# Run all system xinitrc shell scripts
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
    for script in $xinitdir/*; do
        echo "Loading xinit script $script"
        if [ -x "$script" -a ! -d "$script" ]; then
            . "$script"
        fi
    done
fi

# Run user xsession shell script
script="$HOME/.xsession"
if [ -x "$script" -a ! -d "$script" ]; then
    echo "Loading xsession script $script"
    . "$script"
fi

echo "X session wrapper complete, running session $@"

exec $@

Offline

#6 2021-02-21 15:36:39

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,560

Re: [SOLVED] Issue with setting environment variables in bspwm

Does it work if you log into a tty?

Offline

#7 2021-02-21 15:38:40

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

Scimmia wrote:

Does it work if you log into a tty?

Yes it does

Offline

#8 2021-02-21 15:40:42

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

stat /bin/sh

If you add

export FOO=bar

to /etc/lightdm/Xsession, does it get exported?

Online

#9 2021-02-21 15:45:22

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

[ben@Solgaleo ~]$ stat /bin/sh
  File: /bin/sh -> bash
  Size: 4         	Blocks: 0          IO Block: 4096   symbolic link
Device: 10301h/66305d	Inode: 27532598    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-02-20 21:49:20.112517803 +0100
Modify: 2020-12-20 19:44:21.000000000 +0100
Change: 2020-12-24 13:44:49.290362625 +0100
 Birth: 2020-12-24 13:44:49.290362625 +0100

If you add

export FOO=bar

to /etc/lightdm/Xsession, does it get exported?

Nope

Offline

#10 2021-02-21 15:46:27

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

What if you don't autologin?

Online

#11 2021-02-21 15:55:23

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

seth wrote:

What if you don't autologin?

LightDM login window is displayed. I login, open a terminal:

[ben@Solgaleo ~]$ echo $FOO

[ben@Solgaleo ~]$ echo $_JAVA_AWT_WM_NONREPARENTING

Not working

Last edited by neopium (2021-02-21 15:55:45)

Offline

#12 2021-02-21 15:57:46

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

*grummel*…

What if you swap out bspwm for openbox?

Online

#13 2021-02-21 16:22:18

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

I don't have openbox installed, but I'm not sure the fact that lightDM does not run the Xsession file is related. Or is it? I think bspwm is run *after* lightDM...

I looked at the lightDM log. First thing that seems strange is that the /var/log/lightdm/ folder is a root folder with 600 rights (not readable by user). But maybe that's normal, idk.

[ben@Solgaleo ~]$ sudo cat /var/log/lightdm/lightdm.log
[sudo] password for ben: 
[+0.00s] DEBUG: Logging to /var/log/lightdm/lightdm.log
[+0.00s] DEBUG: Starting Light Display Manager 1.30.0, UID=0 PID=638
[+0.00s] DEBUG: Loading configuration dirs from /usr/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /usr/local/share/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration dirs from /etc/xdg/lightdm/lightdm.conf.d
[+0.00s] DEBUG: Loading configuration from /etc/lightdm/lightdm.conf
[+0.00s] DEBUG:   [LightDM] contains unknown option greeter-setup-script
[+0.00s] DEBUG: Registered seat module local
[+0.00s] DEBUG: Registered seat module xremote
[+0.00s] DEBUG: Using D-Bus name org.freedesktop.DisplayManager
[+0.00s] DEBUG: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ‘gio-vfs’
[+0.00s] DEBUG: Monitoring logind for seats
[+0.00s] DEBUG: New seat added from logind: seat0
[+0.00s] DEBUG: Seat seat0: Loading properties from config section Seat:*
[+0.00s] DEBUG: Seat seat0 has property CanMultiSession=no
[+0.00s] DEBUG: Seat seat0: Starting
[+0.00s] DEBUG: Seat seat0: Creating greeter session
[+0.00s] DEBUG: Seat seat0: Creating display server of type x
[+0.00s] DEBUG: Could not run plymouth --ping: Failed to execute child process “plymouth” (No such file or directory)
[+0.00s] DEBUG: Using VT 7
[+0.00s] DEBUG: Seat seat0: Starting local X display on VT 7
[+0.00s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log
[+0.00s] DEBUG: XServer 0: Writing X server authority to /run/lightdm/root/:0
[+0.00s] DEBUG: XServer 0: Launching X Server
[+0.00s] DEBUG: Launching process 644: /usr/bin/X -bs -core :0 -seat seat0 -auth /run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
[+0.00s] DEBUG: XServer 0: Waiting for ready signal from X server :0
[+0.00s] DEBUG: Acquired bus name org.freedesktop.DisplayManager
[+0.00s] DEBUG: Registering seat with bus path /org/freedesktop/DisplayManager/Seat0
[+0.00s] WARNING: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files
[+0.00s] DEBUG: Loading user config from /etc/lightdm/users.conf
[+0.00s] DEBUG: User ben added
[+1.12s] DEBUG: Got signal 10 from process 644
[+1.12s] DEBUG: XServer 0: Got signal from X server :0
[+1.12s] DEBUG: XServer 0: Connecting to XServer :0
[+1.12s] DEBUG: Seat seat0: Display server ready, starting session authentication
[+1.12s] DEBUG: Session pid=695: Started with service 'lightdm-greeter', username 'lightdm'
[+1.13s] DEBUG: Session pid=695: Authentication complete with return value 0: Success
[+1.13s] DEBUG: Seat seat0: Session authenticated, running command
[+1.13s] DEBUG: Session pid=695: Running command /usr/bin/lightdm-gtk-greeter
[+1.13s] DEBUG: Creating shared data directory /var/lib/lightdm-data/lightdm
[+1.13s] DEBUG: Session pid=695: Logging to /var/log/lightdm/seat0-greeter.log
[+1.26s] DEBUG: Activating VT 7
[+1.26s] DEBUG: Activating login1 session c1
[+1.26s] DEBUG: Seat seat0 changes active session to c1
[+1.26s] DEBUG: Session c1 is already active
[+1.41s] DEBUG: Greeter connected version=1.30.0 api=1 resettable=false
[+1.50s] DEBUG: Greeter start authentication for ben
[+1.50s] DEBUG: Session pid=735: Started with service 'lightdm', username 'ben'
[+1.51s] DEBUG: Session pid=735: Got 1 message(s) from PAM
[+1.51s] DEBUG: Prompt greeter with 1 message(s)
[+9.67s] DEBUG: Continue authentication
[+9.68s] DEBUG: Session pid=735: Authentication complete with return value 0: Success
[+9.68s] DEBUG: Authenticate result for user ben: Success
[+9.68s] DEBUG: User ben authorized
[+9.69s] DEBUG: Greeter requests session bspwm
[+9.69s] DEBUG: Seat seat0: Stopping greeter; display server will be re-used for user session
[+9.69s] DEBUG: Terminating login1 session c1
[+9.69s] DEBUG: Session pid=695: Sending SIGTERM
[+9.70s] DEBUG: Greeter closed communication channel
[+9.70s] DEBUG: Session pid=695: Exited with return value 0
[+9.70s] DEBUG: Seat seat0: Session stopped
[+9.70s] DEBUG: Seat seat0: Greeter stopped, running session
[+9.70s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session0
[+9.70s] DEBUG: Session pid=735: Running command /etc/lightdm/Xsession bspwm
[+9.70s] DEBUG: Creating shared data directory /var/lib/lightdm-data/ben
[+9.70s] DEBUG: Session pid=735: Logging to .xsession-errors
[+9.81s] DEBUG: Activating VT 7
[+9.81s] DEBUG: Activating login1 session 2
[+9.81s] DEBUG: Seat seat0 changes active session to 
[+9.81s] DEBUG: Seat seat0 changes active session to 2
[+9.81s] DEBUG: Session 2 is already active

Appart from the DBus error, everything looks fine. I don't see the messages from the Xsession file (e.g. echo "Running X session wrapper"), but maybe they are logged somewhere else...

Offline

#14 2021-02-21 16:27:24

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

I don't have openbox installed

So?

lightDM does not run the Xsession file is related. Or is it? I think bspwm

We don't really know that and I'd like to ensure that your session doesn't just wipe the environment and rebuild it itself.

[+9.70s] DEBUG: Session pid=735: Running command /etc/lightdm/Xsession bspwm
[+9.70s] DEBUG: Creating shared data directory /var/lib/lightdm-data/ben
[+9.70s] DEBUG: Session pid=735: Logging to .xsession-errors

Look at ~/.xsession-errors but the log says that /etc/lightdm/Xsession is used as session wrapper.

Online

#15 2021-02-21 16:38:18

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [SOLVED] Issue with setting environment variables in bspwm

Try creating /usr/share/xsessions/test.desktop with the following contents

[Desktop Entry]
Name=Test
Comment=Test Session
Exec=sh -c 'env > /tmp/env.txt'
Icon=
Type=Application

Execute that session and see if /tmp/env.txt is created and what is in it.

Offline

#16 2021-02-21 16:44:49

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

seth wrote:

I don't have openbox installed

So?

I though it would be complicated and require gazillions of dependencies...

Turns out it does not smile, so I did install it.

... And it works

[ben@Solgaleo ~]$ echo $_JAVA_AWT_WM_NONREPARENTING
1

So the problem *is* related to bspwm

Offline

#17 2021-02-21 16:49:57

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

loqs wrote:

Try creating /usr/share/xsessions/test.desktop with the following contents

[Desktop Entry]
Name=Test
Comment=Test Session
Exec=sh -c 'env > /tmp/env.txt'
Icon=
Type=Application

Execute that session and see if /tmp/env.txt is created and what is in it.

I tried that. Selected that Test session in LightDM, logged in. Black screen then back to LightDM. Logged in with BSPWM, there's no /tmp/env.txt file

Last edited by neopium (2021-02-21 16:50:18)

Offline

#18 2021-02-21 16:57:38

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

Here is the .xsession-errors file:

polybar|notice:  Parsing config file: /home/ben/.config/polybar/config
Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/bin/../lib/kitty/__main__.py", line 127, in <module>
    main()
  File "/usr/bin/../lib/kitty/__main__.py", line 123, in main
    func(sys.argv[1:])
  File "/usr/bin/../lib/kitty/__main__.py", line 23, in remote_control
    rc_main(args)
  File "/usr/bin/../lib/kitty/kitty/remote_control.py", line 188, in main
    response = do_io(global_opts.to, send, no_response)
  File "/usr/bin/../lib/kitty/kitty/remote_control.py", line 132, in do_io
    with io:
  File "/usr/bin/../lib/kitty/kitty/utils.py", line 429, in __enter__
    self.tty_fd, self.original_termios = open_tty(True)
OSError: Failed to open controlling terminal: /dev/tty (identified with ctermid()) with error: No such device or address
polybar|notice:  pulseaudio: using default sink alsa_output.pci-0000_0b_00.4.analog-stereo
polybar|notice:  Loaded font "Roboto:pixelsize=10" (name=Roboto, offset=1, file=/usr/share/fonts/TTF/Roboto-Regular.ttf)
polybar|notice:  Loaded font "Font Awesome 5 Free Solid:pixelsize=10" (name=Font Awesome 5 Free, offset=1, file=/usr/share/fonts/TTF/fa-solid-900.ttf)
polybar|notice:  Loaded font "Material Icons:pixelsize=10" (name=Material Icons, offset=1, file=/usr/share/fonts/TTF/MaterialIcons-Regular.ttf)

Offline

#19 2021-02-21 17:15:30

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [SOLVED] Issue with setting environment variables in bspwm

If bspwm was restarted that looks like it would clean the environment https://github.com/baskerville/bspwm/bl … pwm.c#L308
Edit:
No that was wrong.

Is the shell directly started by bspwm?

Last edited by loqs (2021-02-21 17:20:36)

Offline

#20 2021-02-21 17:25:46

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

loqs wrote:

Is the shell directly started by bspwm?

I don't think so. Here is my config file:

[ben@Solgaleo bspwm]$ cat bspwmrc 
#! /bin/sh

##############################
# BSPWM configuration
##############################

bspc monitor -d 1 2 3 4 5

bspc config border_width         3
bspc config window_gap           12

## color settings
bspc config focused_border_color "#268bd2" 
#bspc config normal_border_color "#002b36"

bspc config focus_follows_pointer true
bspc config split_ratio          0.5
bspc config borderless_monocle   true
bspc config gapless_monocle      true

##############################
# Window rules
##############################

bspc rule -a oblogout floating=on fullscreen=on
bspc rule -a clearine floating=on fullscreen=on
bspc rule -a steam_app_1182480:origin.exe state=floating

##############################
# Autostart
##############################

# Reload compton
pkill compton
compton --config $HOME/.config/compton.conf -b &

# Authentication daemon
pkill polkit-gnome-authentication-agent-1
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &

# Numeric lock always ON
numlockx on &

# Launch wallpaper application
feh --bg-fill ~/Pictures/Wallpapers/"$(ls ~/Pictures/Wallpapers/|shuf -n 1)"

# Launch astrality
#pkill astrality
#astrality > ~/.config/astrality/out.log 2>&1 &

pkill polybar
polybar --config=~/.config/polybar/config --reload HDMI-0&

# Update kitty colors
kitty @ set-colors --all --configured ~/.config/kitty/kitty.conf

# Keyboard bindings manager
#pkill sxhkd
#sxhkd -m 1&
systemctl --user restart sxhkd&

Edit:

By the way, the line "kitty @ set-colors --all --configured ~/.config/kitty/kitty.conf" was the one that caused the python error message in the .xsession-errors file. I commented it, the new xsession-errors files is now:

[ben@Solgaleo ~]$ cat .xsession-errors
polybar|notice:  Parsing config file: /home/ben/.config/polybar/config
polybar|notice:  pulseaudio: using default sink alsa_output.pci-0000_0b_00.4.analog-stereo
polybar|notice:  Loaded font "Roboto:pixelsize=10" (name=Roboto, offset=1, file=/usr/share/fonts/TTF/Roboto-Regular.ttf)
polybar|notice:  Loaded font "Font Awesome 5 Free Solid:pixelsize=10" (name=Font Awesome 5 Free, offset=1, file=/usr/share/fonts/TTF/fa-solid-900.ttf)
polybar|notice:  Loaded font "Material Icons:pixelsize=10" (name=Material Icons, offset=1, file=/usr/share/fonts/TTF/MaterialIcons-Regular.ttf)

Last edited by neopium (2021-02-21 17:30:30)

Offline

#21 2021-02-21 18:30:19

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

Ie. you likely start the terminal w/ some sxhkd shortcut?
Which and what does it run how.
And what is the sxhkd and bspwm environment?

tr '\0' '\n' < /proc/$(pidof bspwm)/environ
tr '\0' '\n' < /proc/$(pidof sxhkd)/environ

Online

#22 2021-02-21 18:50:47

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

Edit: edited with the actual PIDs

BSPWM

[ben@Solgaleo ~]$ tr '\0' '\n' < /proc/945/environ
SHELL=/bin/bash
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
DESKTOP_SESSION=bspwm
GTK_MODULES=canberra-gtk-module
XDG_SEAT=seat0
PWD=/home/ben
XDG_SESSION_DESKTOP=bspwm
LOGNAME=ben
XDG_SESSION_TYPE=x11
PROTON_FORCE_LARGE_ADDRESS_AWARE=1
XAUTHORITY=/home/ben/.Xauthority
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/ben
MOTD_SHOWN=pam
FOO=bar
HOME=/home/ben
LANG=en_GB.utf8
_JAVA_AWT_WM_NONREPARENTING=1
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
USER=ben
DISPLAY=:0
SHLVL=0
XDG_VTNR=7
XDG_SESSION_ID=2
XDG_RUNTIME_DIR=/run/user/1000
PATH=/home/ben/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
GDMSESSION=bspwm
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/ben
[ben@Solgaleo ~]$ ps aux |grep sxhkd
ben          998  0.0  0.0   2864  2156 ?        Ss   18:27   0:00 /usr/bin/sxhkd -m 1
ben        17788  0.0  0.0   6408  2332 pts/0    S+   19:53   0:00 grep sxhkd
[ben@Solgaleo ~]$ tr '\0' '\n' < /proc/2156/environ
bash: /proc/2156/environ: No such file or directory
[ben@Solgaleo ~]$ cat .config/sxhkd/sxhkdrc 
#
# wm independent hotkeys
#

super + f
        nautilus --new-window

# terminal emulator
super + Return
	kitty --single-instance

# program launcher
super + space
	rofi -modi "run,window,drun" -show drun -sidebar-mode -terminal kitty -icon-theme Newaita-dark

# Volume control
XF86AudioLowerVolume
        pactl set-sink-volume @DEFAULT_SINK@ -5%

XF86AudioRaiseVolume
        pactl set-sink-volume @DEFAULT_SINK@ +5%

XF86AudioMute
        pactl set-sink-mute @DEFAULT_SINK@ toggle

# make sxhkd reload its configuration files:
#super + Escape
#	pkill -USR1 -x sxhkd

# Print screen
Print
        scrot -e 'mv $f ~/Pictures/Screenshots'

# Logout screen
super + Escape
        clearine

#
# bspwm hotkeys
#

# Switch between windows
#alt + Tab
#        rofi -show window -icon-theme Newaita-dark

# quit/restart bspwm
super + alt + {q,r}
	bspc {quit,wm -r}

# close and kill
super + {_,shift + }w
	bspc node -{c,k}

# alternate between the tiled and monocle layout
super + m
	bspc desktop -l next

# send the newest marked node to the newest preselected node
super + y
	bspc node newest.marked.local -n newest.!automatic.local

# swap the current node and the biggest node
super + g
	bspc node -s biggest

#
# state/flags
#

# set the window state
super + {t,shift + t,s,shift + f}
	bspc node -t {tiled,pseudo_tiled,floating,fullscreen}

# set the node flags
super + ctrl + {m,x,y,z}
	bspc node -g {marked,locked,sticky,private}

#
# focus/swap
#

# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
	bspc node -{f,s} {west,south,north,east}

super + {_,shift + }{Left,Down,Up,Right}
	bspc node -{f,s} {west,south,north,east}

# focus the node for the given path jump
super + {p,b,comma,period}
	bspc node -f @{parent,brother,first,second}

# focus the next/previous node in the current desktop
super + {_,shift + }c
	bspc node -f {next,prev}.local

# focus the next/previous desktop in the current monitor
super + bracket{left,right}
	bspc desktop -f {prev,next}.local

# focus the last node/desktop
super + {grave,Tab}
	bspc {node,desktop} -f last

# focus the older or newer node in the focus history
super + {o,i}
	bspc wm -h off; \
	bspc node {older,newer} -f; \
	bspc wm -h on

# focus or send to the given desktop
#super + {_,shift + }{1-9,0}
#	bspc {desktop -f,node -d} '^{1-9,10}'

# Focus selected desktop for azerty keyboards
super + {ampersand,eacute,quotedbl,apostrophe,parenleft,section,egrave,exclam,ccedilla,agrave}
        bspc desktop -f '^{1-9,10}'

# Move window to the given desktop
super + shift + {ampersand,eacute,quotedbl,apostrophe,parenleft,section,egrave,exclam,ccedilla,agrave}
        id=$(bspc query -N -n); bspc node -d ^{1-9,10};bspc node -f ${id}
#
# preselect
#

# preselect the direction
super + ctrl + {h,j,k,l}
	bspc node -p {west,south,north,east}

super + ctrl + {Left,Down,Up,Right}
	bspc node -p {west,south,north,east}

# preselect the ratio
super + ctrl + {1-9}
	bspc node -o 0.{1-9}

# cancel the preselection for the focused node
super + ctrl + space
	bspc node -p cancel

# cancel the preselection for the focused desktop
super + ctrl + shift + space
	bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel

#
# move/resize
#

# expand a window by moving one of its side outward
super + alt + {h,j,k,l}
	bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}

super + alt + {Left,Down,Up,Right}
	bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}

# contract a window by moving one of its side inward
super + alt + shift + {h,j,k,l}
	bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}

super + alt + shift + {Left,Down,Up,Right}
	bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}

# move a floating window
#super + {Left,Down,Up,Right}
#	bspc node -v {-20 0,0 20,0 -20,20 0}

#
# Default applications
#
super + F1
        firefox&

super + F2
        steam&

super + F3
        lutris&

Last edited by neopium (2021-02-21 18:56:21)

Offline

#23 2021-02-21 18:53:21

seth
Member
Registered: 2012-09-03
Posts: 51,229

Re: [SOLVED] Issue with setting environment variables in bspwm

It's there for bspwm & sxhkd - how exactly do you launch the terminal that doesn't have the variable and what shell (absh/zsh) do you launch in it and what does its rc look like (bashrc/zshrc)?

Online

#24 2021-02-21 18:55:52

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

seth wrote:

It's there for bspwm & sxhkd - how exactly do you launch the terminal that doesn't have the variable and what shell (absh/zsh) do you launch in it and what does its rc look like (bashrc/zshrc)?

This is how I launch a terminal (from sxhkd.rc):

# terminal emulator
super + Return
	kitty --single-instance

Offline

#25 2021-02-21 18:57:09

neopium
Member
Registered: 2019-05-02
Posts: 85

Re: [SOLVED] Issue with setting environment variables in bspwm

The shell is bash:

[ben@Solgaleo ~]$ echo $SHELL
/bin/bash

Offline

Board footer

Powered by FluxBB