diff --git a/env/wm/bspwm_config b/env/wm/bspwm_config index f7ccbcf..6f9bfff 100755 --- a/env/wm/bspwm_config +++ b/env/wm/bspwm_config @@ -20,6 +20,19 @@ bspc config gapless_monocle true bspc config window_gap "$WINDOW_GAP" +if [ "$BAR_ON_XINIT" -eq 1 ]; then + if [ -z "$BAR_MONITOR" -o "$BAR_MONITOR" -eq 0 ]; then + source "$DOTFILES_PATH/scripts/monitors.sh" + BAR_MONITOR="$LAST_BSPWM_MONITOR" + fi + + if [ $BAR_TOP -eq 1 ]; then + bspc config -m ${BAR_MONITOR} top_padding "$BAR_HEIGHT" + else + bspc config -m ${BAR_MONITOR} bottom_padding "$BAR_HEIGHT" + fi +fi + echo "${BSPWM_MONITORS}" BSPWM_MONITORS=$(bspc query -M | tac) diff --git a/env/wm/bspwmrc b/env/wm/bspwmrc index 3c49727..5810080 100755 --- a/env/wm/bspwmrc +++ b/env/wm/bspwmrc @@ -10,4 +10,3 @@ bspc wm -o urxvtd & sxhkd & - diff --git a/env/wm/extras/bar/start.bash b/env/wm/extras/bar/start.bash index 140d11e..27a91e9 100755 --- a/env/wm/extras/bar/start.bash +++ b/env/wm/extras/bar/start.bash @@ -29,6 +29,11 @@ trap killbar INT TERM QUIT EXIT rm -f "$BAR_FIFO" mkfifo "$BAR_FIFO" +if [ -z "$BAR_MONITOR" -o "$BAR_MONITOR" -eq 0 ]; then + source "$DOTFILES_PATH/scripts/monitors.sh" + BAR_MONITOR="$LAST_BSPWM_MONITOR" +fi + if [ $BAR_TOP -eq 1 ]; then bspc config -m ${BAR_MONITOR} top_padding "$BAR_HEIGHT" else diff --git a/scripts/monitors.sh b/scripts/monitors.sh new file mode 100644 index 0000000..cd14ac7 --- /dev/null +++ b/scripts/monitors.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +export LAST_BSPWM_MONITOR=$(bspc query -M | tail -n 1) +export FIRST_BSPWM_MONITOR=$(bspc query -M | head -n 1) diff --git a/variables.bash b/variables.bash index 68c4471..d8942a5 100755 --- a/variables.bash +++ b/variables.bash @@ -16,7 +16,7 @@ export BAR_PATH="$DOTFILES_PATH/env/wm/extras/bar" export BAR_PID_FILE="$BAR_PATH/wm_bar.pid" export BAR_ON_XINIT=1 export BAR_FIFO="$BAR_PATH/wm_bar_fifo.lock" -export BAR_MONITOR=$(bspc query -M | tail -n 1) +export BAR_MONITOR=0 # detect monitor automatically export BAR_LOG="$BAR_PATH/wm_bar.log" export BAR_TOP=0 export BAR_HEIGHT=30