Polybar: Switch to startup script
This commit is contained in:
parent
6c994606d4
commit
b6ac612d1b
@ -38,11 +38,8 @@ if [[ $(pgrep polybar) ]]; then
|
|||||||
killall polybar
|
killall polybar
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Polybar and related configuration
|
# Start Polybar
|
||||||
$(
|
$HOME/.config/polybar/start.sh
|
||||||
export PB_WM_RESTACK=bspwm
|
|
||||||
polybar -r primary-top &
|
|
||||||
)&
|
|
||||||
|
|
||||||
## bspwm GENERAL CONFIGURATION
|
## bspwm GENERAL CONFIGURATION
|
||||||
bspc monitor -d 1 2 3 4 5 6 7 8
|
bspc monitor -d 1 2 3 4 5 6 7 8
|
||||||
|
@ -73,6 +73,7 @@ font-4 = ${res/fonts.font-4}
|
|||||||
# BARS
|
# BARS
|
||||||
#====================
|
#====================
|
||||||
[bar/primary-top]
|
[bar/primary-top]
|
||||||
|
monitor = ${env:PB_MONITOR}
|
||||||
inherit = template/bar
|
inherit = template/bar
|
||||||
tray-position = right
|
tray-position = right
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ modules-center = xwindow
|
|||||||
modules-right = xbacklight volume battery wlan date
|
modules-right = xbacklight volume battery wlan date
|
||||||
|
|
||||||
[bar/secondary-top]
|
[bar/secondary-top]
|
||||||
|
monitor = ${env:PB_MONITOR}
|
||||||
inherit = template/bar
|
inherit = template/bar
|
||||||
|
|
||||||
modules-left = i3 bspwm
|
modules-left = i3 bspwm
|
||||||
|
37
.config/polybar/start.sh
Executable file
37
.config/polybar/start.sh
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# start.sh
|
||||||
|
# Copyright (C) 2018 salt <salt@iridium>
|
||||||
|
#
|
||||||
|
# Distributed under terms of the MIT license.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Which WM are we using?
|
||||||
|
if $(pgrep i3); then
|
||||||
|
export PB_WM_RESTACK=i3
|
||||||
|
fi
|
||||||
|
if $(pgrep bspwm); then
|
||||||
|
export PB_WM_RESTACK=bspwm
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Iterate through monitors and spawn bars on each
|
||||||
|
# Starting with the primary monitor...
|
||||||
|
export PB_MONITOR=$(xrandr -q | awk '/\<primary\>/{print $1}')
|
||||||
|
if [[ $PB_MONITOR == "" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
polybar -r primary-top&
|
||||||
|
# ...and then moving on to secondaries, if we have them
|
||||||
|
# Alright, now this looks *really* bad, but there's no way in hell you can get
|
||||||
|
# me to attempt to solve this with regex. Fuck regex. It starts more problems
|
||||||
|
# than it solves
|
||||||
|
export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}')
|
||||||
|
if [[ $PB_MONITOR == "" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
for monitor in secondary_monitors; do
|
||||||
|
PB_MONITOR=$monitor polybar -r secondary-top
|
||||||
|
done
|
||||||
|
|
||||||
|
disown
|
||||||
|
exit
|
Loading…
Reference in New Issue
Block a user