You are not logged in.

#26 2021-02-21 18:58:50

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

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

And the bash.rc file:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

PS1='[\u@\h \W]\$ '

if [ -e ~/.bashrc.aliases ] ; then
   source ~/.bashrc.aliases
fi

EDITOR=/usr/bin/nvim

if ! pgrep -u "$USER" ssh-agent > /dev/null; then
    ssh-agent | grep -v echo >~/.ssh-agent-thing
fi
if [[ ! "$SSH_AUTH_SOCK" ]]; then
    eval "$(<~/.ssh-agent-thing)"
fi

neofetch

The .bashrc.aliases file:

#
# ~/.bashrc.aliases
#

alias ls='ls --color=auto'
alias ll='ls -lh --color=auto'
alias la='ls -alh --color=auto'

alias gotop='gotop -p'

alias vi='nvim'

alias pacrepo='sudo reflector -l 20 -f 10 --save /etc/pacman.d/mirrorlist'
alias journalctl='sudo journalctl'
alias pacu='sudo pacman -Syu'
alias yayu='yay -Syu'
alias se='ls /usr/bin | grep'

alias doci="docker image"
alias docc="docker container"
alias doccs="docker container inspect --format {{.State.Status}}"

alias rdev-gpu="/home/ben/Development/docker/deep-learning-r/runContainerGPU.sh"

export QT_STYLE_OVERRIDE=gtk
export QT_SELECT=qt5
export BROWSER=firefox

if [[ $LANG = '' ]]; then
	export LANG=en_GB.UTF-8
fi

Offline

#27 2021-02-21 19:03:55

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

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

Did you also use kitty under openbox when the variable was preserved?

Offline

#28 2021-02-21 19:10:48

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

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

Yes I did. From /etc/xdg/openbox/menu.xml:

[...]
<menu id="apps-term-menu" label="Terminals">
[...]
  <item label="Kitty">
    <action name="Execute">
      <command>kitty</command>
      <startupnotify>
        <enabled>yes</enabled>
      </startupnotify>
    </action>
  </item>
[...]

Offline

#29 2021-02-21 19:12:41

seth
Member
Registered: 2012-09-03
Posts: 50,008

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

Lacks the "--single-instance" part…

Offline

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

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

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

seth wrote:

Lacks the "--single-instance" part…

I noticed. I just added it in the configuration file, logged out from bspwm, logged in with openbox and ran kitty --single-instance (via the menu). It works, the environment variable is set to 1.

Offline

#31 2021-02-21 19:22:02

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

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

What if you replace kitty with xterm under bspwm via sxhkd.  Also try launching both kitty and xterm directly from bspwmrc.

Offline

#32 2021-02-21 20:37:27

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

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

loqs wrote:

What if you replace kitty with xterm under bspwm via sxhkd.  Also try launching both kitty and xterm directly from bspwmrc.

That's interesting!

I added a new entry in sxhkdrc:

# terminal emulator
super + Return
	kitty

super + shift + Return
        xterm

Neither work.

However, when I added `xterm&` at the end of the bspwmrc file, it opens a xterm at startup that has the correct environment variables!

Maybe the problem lies in (extract from the bspwmrc file):

systemctl --user restart sxhkd&

This might be were this post lead to...

[ben@Solgaleo system]$ cat /home/ben/.config/systemd/user/sxhkd.service
[Unit]
Description=Simple X Hotkey Daemon
Documentation=man:sxhkd(1)

[Service]
ExecStart=/usr/bin/sxhkd -m 1
ExecReload=/usr/bin/kill -SIGUSR1 $MAINPID

[Install]
WantedBy=default.target

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

Offline

#33 2021-02-21 20:43:53

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

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

I also tryed adding kitty& at the end of the bspwmrc file and it also works

Offline

#34 2021-02-21 20:48:15

seth
Member
Registered: 2012-09-03
Posts: 50,008

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

If you

ExecStartPre=systemctl --user import-environment

?

Offline

#35 2021-02-21 20:52:49

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

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

seth wrote:

If you

ExecStartPre=systemctl --user import-environment

?

No luck

[Unit]
Description=Simple X Hotkey Daemon
Documentation=man:sxhkd(1)

[Service]
ExecStartPre=systemctl --user import-environment
ExecStart=/usr/bin/sxhkd -m 1
ExecReload=/usr/bin/kill -SIGUSR1 $MAINPID

[Install]
WantedBy=default.target

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

Offline

#36 2021-02-21 21:00:10

seth
Member
Registered: 2012-09-03
Posts: 50,008

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

I don't remember any discussion in the other thread, but "Just don't run sxhkd as systemd user service"?

Offline

#37 2021-02-21 21:08:26

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

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

seth wrote:

I don't remember any discussion in the other thread, but "Just don't run sxhkd as systemd user service"?

Well, this is what I just did... In my bspwmrc file, I changed

systemctl --user restart sxhkd&

Back to

pkill sxhkd
sxhkd -m 1&

... and it works again.

So yes, you are right:

Just don't run sxhkd as systemd user service

I just tried to follow the Wiki... I shouldn't have in this case, it "kinda worked" for more than 8 months, until it didn't.

Thanks for your help and sorry I wasted your time.

This is what I should have done last July:

If it's not broken, don't fix it

Last edited by neopium (2021-02-21 21:10:11)

Offline

Board footer

Powered by FluxBB