fix(env): move env variables to skel/.profile
When using super + space, dmenu_recent outputs the following error to
.xsession-errors
:
```
usage: dmenu [-bfiv] [-l lines] [-p prompt] [-fn font] [-m monitor]
[-h height] [-x xoffset] [-y yoffset] [-w width]
[-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
```
I believe this error occurs because $PANEL_HEIGHT is empty/null since it is only defined in bspwmrc.
OLD
To share variables between bspwmrc
and sxhkdrc
, they are moved to a separate env file and sourced in the bspwm-session
script.
I am unsure what the correct approach is on this one. See proposed patch below:
The following changes since commit f7c9dfd963367635a64969919454582f15aa17db:
Update bspwm-manjaro (2019-05-27 22:51:25 +0300)
are available in the Git repository at:
https://gitlab.com/sevillaarvin/bspwm-manjaro.git patch-3
for you to fetch changes up to 3339669ca3abdf14cbdd67d3e2b5ee250896d40a:
fix(env): move env variables to separate file (2021-11-16 19:07:05 +0800)
----------------------------------------------------------------
Arvin Sevilla (1):
fix(env): move env variables to separate file
PKGBUILD | 1 +
bspwm-session | 3 +++
bspwmenv | 5 +++++
bspwmrc | 4 ----
4 files changed, 9 insertions(+), 4 deletions(-)
create mode 100644 bspwmenv
diff --git a/PKGBUILD b/PKGBUILD
index 1816a6e..9952b93 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -45,4 +45,5 @@ package() {
install -Dm755 "$startdir/sxhkdrc" "$pkgdir/etc/skel/.config/sxhkd/sxhkdrc"
install -Dm755 "$startdir/sxhkdrc-minimal" "$pkgdir/etc/skel/.config/sxhkd/sxhkdrc-minimal"
install -Dm755 "$startdir/bspwmrc" "$pkgdir/etc/skel/.config/bspwm/bspwmrc"
+ install -Dm755 "$startdir/bspwmenv" "$pkgdir/etc/skel/.config/bspwm/bspwmenv"
}
diff --git a/bspwm-session b/bspwm-session
index 2ddc4ee..d878d6c 100644
--- a/bspwm-session
+++ b/bspwm-session
@@ -28,6 +28,9 @@ for file in /etc/profile ${HOME}/.profile ${HOME}/.config/bspwm/autostart ; do
[ -r "${file}" ] && . "${file}"
done
+# Source env variables
+. ${HOME}/.config/bspwm/bspwmenv
+
# Launch sxhkd:
[ -e /bin/dash ] && export SXHKD_SHELL="/bin/dash"
sxhkd &
diff --git a/bspwmenv b/bspwmenv
new file mode 100644
index 0000000..dc46aa8
--- /dev/null
+++ b/bspwmenv
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+export gap=15
+export PANEL_HEIGHT=25
+
diff --git a/bspwmrc b/bspwmrc
index 48ae050..8a22923 100644
--- a/bspwmrc
+++ b/bspwmrc
@@ -1,8 +1,4 @@
#! /bin/sh
-gap=15
-PANEL_HEIGHT=25
-export gap
-export PANEL_HEIGHT
#This creates negative padding equal to window gap so that gaps are shown only between windows and not on desktop edges.
bspc config window_gap $gap;
EDIT:
Proposed solution is to add env variables to .profile
The following changes since commit f7c9dfd963367635a64969919454582f15aa17db:
Update bspwm-manjaro (2019-05-27 22:51:25 +0300)
are available in the Git repository at:
https://gitlab.com/sevillaarvin/bspwm-manjaro.git patch-3
for you to fetch changes up to bc53bed678c2f2d21747ad719357301216787683:
fix(install): add default env variables to skel/.profile (2021-11-17 11:47:39 +0800)
----------------------------------------------------------------
Arvin Sevilla (2):
fix(env): move env variables to separate file
fix(install): add default env variables to skel/.profile
bspwm-manjaro.install | 14 +++++++++++++-
bspwmrc | 4 ----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/bspwm-manjaro.install b/bspwm-manjaro.install
index 82b4637..3913926 100644
--- a/bspwm-manjaro.install
+++ b/bspwm-manjaro.install
@@ -37,4 +37,16 @@ post_upgrade() {
post_install() {
[ -e /usr/bin/mygtkmenui ] || cp /etc/skel/.config/sxhkdrc/sxhkdrc-minimal /etc/skel/.config/sxhkdrc/sxhkdrc
-}
\ No newline at end of file
+
+ profile=/etc/skel/.profile
+ if ! [ -f $profile ]
+ then
+ touch $profile
+ fi
+
+ grep -q "export TERMINAL" $profile || echo export TERMINAL=xfce4-terminal >> $profile
+ grep -q "export BROWSER" $profile || echo export BROWSER=firefox >> $profile
+ grep -q "export GUI_EDITOR" $profile || echo export GUI_EDITOR=code >> $profile
+ grep -q "export gap" $profile || echo export gap=15 >> $profile
+ grep -q "export PANEL_HEIGHT" $profile || echo export PANEL_HEIGHT=25 >> $profile
+}
diff --git a/bspwmrc b/bspwmrc
index 48ae050..8a22923 100644
--- a/bspwmrc
+++ b/bspwmrc
@@ -1,8 +1,4 @@
#! /bin/sh
-gap=15
-PANEL_HEIGHT=25
-export gap
-export PANEL_HEIGHT
#This creates negative padding equal to window gap so that gaps are shown only between windows and not on desktop edges.
bspc config window_gap $gap;