#!/usr/bin/env bash #kill all polybar instances CPID=$(pgrep -x polybar) if [ -n "${CPID}" ] ; then kill -TERM ${CPID} fi # add window titles & launch the bars # using bspc query here to get monitors in the same order bspwm sees them for m in $( bspc query -M --names ); do index=$((index + 1)) if [[ $index -eq 1 ]]; then export P_BSPWM_WINDOW_CMD_1="tail ${HOME}/.cache/bspwm_windows_1.txt" MONITOR=$m polybar --reload main & fi #if [ && [ $(xrandr -q | grep 'DP-2 connected') ]]; then if [[ $index -eq 2 ]]; then export P_BSPWM_WINDOW_CMD_2="tail ${HOME}/.cache/bspwm_windows_2.txt" MONITOR=$m polybar --reload external & fi done