This repository has been archived on 2025-01-31. You can view files and clone it, but cannot push or open issues or pull requests.
Files
.bin
.config
autostart
bspwm
conky
dunst
firestarter
htop
i3
mpd
mpv
polybar
config
launch.sh
pulse
qt5ct
rofi
skhd
sxhkd
syncthing-gtk
yabai
compton.conf
dircolors
kglobalshortcutsrc
khotkeysrc
ptgdp.conf
redshift.conf
user-dirs.dirs
user-dirs.locale
.firestarter
.local
.ssh
.vim
.bashrc
.functions
.gitconfig
.gitmodules
.inputrc
.joy2keyrc
.profile
.vimrc
.xinitrc
.xsessionrc
home/.config/polybar/launch.sh
Salt 3eb97cf37a Polybar: Re-remove shitty wait hack
Now we don't need it because Firestarter is actually doing its job again
2020-06-07 07:14:41 -05:00

77 lines
1.4 KiB
Bash
Executable File

#! /bin/bash
#
# launch.sh
# A Polybar launch script with a heck of a lot of compat
# Copyright (C) 2019 Vintage Salt <rehashedsalt@cock.li>
#
# Distributed under terms of the MIT license.
#
log() {
[ -z "$1" ] && return 1
printf "$1\\n"
}
# Trap our exit
die() {
kill $(jobs -p)
}
trap die EXIT
# Steps
step_fallback() {
if ! command -v polybar > /dev/null 2>&1; then
if command -v tint2 > /dev/null 2>&1; then
log "Executing fallback"
exec tint2
fi
log "No valid bars found"
exit 51
fi
}
step_configure() {
# Restack compatibility
if pgrep -U "$UID" bspwm > /dev/null 2>&1; then
export PB_WM_RESTACK="bspwm"
elif pgrep -U "$UID" i3 > /dev/null 2>&1; then
export PB_WM_RESTACK="i3"
fi
}
step_spawn_primary() {
# Spawn bars on the primary monitor
log "Spawning primary bars"
export PB_MONITOR=$(xrandr -q | awk '/primary/{print $1}')
polybar -r primary &
polybar -r primary-2 &
}
step_spawn_secondary() {
# Spawn more for each secondary
log "Spawning secondary bars"
export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}')
if [ "$secondary_monitors" == "" ]; then
return 0
fi
for monitor in $secondary_monitors; do
PB_MONITOR=$monitor
polybar -r secondary &
polybar -r secondary-2 &
done
}
step_wait() {
# And wait
log "Waiting"
wait
}
# Main
main() {
step_fallback
step_configure
step_spawn_primary
step_spawn_secondary
step_wait
}
main "$@"