Polybar: Fix erroneous fallback, add logging
This commit is contained in:
parent
d93e7bc530
commit
748d8ad04d
@ -7,6 +7,11 @@
|
|||||||
# Distributed under terms of the MIT license.
|
# Distributed under terms of the MIT license.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
log() {
|
||||||
|
[ -z "$1" ] && return 1
|
||||||
|
printf "$1\\n"
|
||||||
|
}
|
||||||
|
|
||||||
# Trap our exit
|
# Trap our exit
|
||||||
die() {
|
die() {
|
||||||
kill $(jobs -p)
|
kill $(jobs -p)
|
||||||
@ -17,10 +22,12 @@ trap die EXIT
|
|||||||
step_fallback() {
|
step_fallback() {
|
||||||
if ! command -v polybar > /dev/null 2>&1; then
|
if ! command -v polybar > /dev/null 2>&1; then
|
||||||
if command -v tint2 > /dev/null 2>&1; then
|
if command -v tint2 > /dev/null 2>&1; then
|
||||||
|
log "Executing fallback"
|
||||||
exec tint2
|
exec tint2
|
||||||
fi
|
fi
|
||||||
fi
|
log "No valid bars found"
|
||||||
exit 51
|
exit 51
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
step_configure_restack() {
|
step_configure_restack() {
|
||||||
# Restack compatibility
|
# Restack compatibility
|
||||||
@ -32,12 +39,14 @@ step_configure_restack() {
|
|||||||
}
|
}
|
||||||
step_spawn_primary() {
|
step_spawn_primary() {
|
||||||
# Spawn bars on the primary monitor
|
# Spawn bars on the primary monitor
|
||||||
|
log "Spawning primary bars"
|
||||||
export PB_MONITOR=$(xrandr -q | awk '/primary/{print $1}')
|
export PB_MONITOR=$(xrandr -q | awk '/primary/{print $1}')
|
||||||
polybar -r primary &
|
polybar -r primary &
|
||||||
polybar -r primary-2 &
|
polybar -r primary-2 &
|
||||||
}
|
}
|
||||||
step_spawn_secondary() {
|
step_spawn_secondary() {
|
||||||
# Spawn more for each secondary
|
# Spawn more for each secondary
|
||||||
|
log "Spawning secondary bars"
|
||||||
export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}')
|
export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}')
|
||||||
if [ "$secondary_monitors" == "" ]; then
|
if [ "$secondary_monitors" == "" ]; then
|
||||||
return 0
|
return 0
|
||||||
@ -50,6 +59,7 @@ step_spawn_secondary() {
|
|||||||
}
|
}
|
||||||
step_wait() {
|
step_wait() {
|
||||||
# And wait
|
# And wait
|
||||||
|
log "Waiting"
|
||||||
wait
|
wait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user