2018-08-26 16:11:25 -05:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Simple wmstartup service
|
|
|
|
# Copyright (C) 2018 salt <salt@lap-th-e560-0>
|
|
|
|
#
|
|
|
|
# Distributed under terms of the MIT license.
|
|
|
|
#
|
|
|
|
|
|
|
|
service_name="Polybar"
|
|
|
|
service_process="polybar"
|
|
|
|
|
|
|
|
function start() {
|
|
|
|
export PB_MONITOR=$(xrandr -q | awk '/primary/{print $1}')
|
|
|
|
svc_log "Starting primary on monitor $PB_MONITOR"
|
|
|
|
polybar -r primary& > /dev/null 2>&1
|
|
|
|
polybar -r primary-2& > /dev/null 2>&1
|
|
|
|
|
|
|
|
export secondary_monitors=$(xrandr -q | grep ' connected' | grep -v 'primary' | awk '{print $1}')
|
|
|
|
if [[ "$secondary_monitors" == "" ]]; then
|
|
|
|
return 0
|
|
|
|
fi
|
2018-08-29 22:20:30 -05:00
|
|
|
for monitor in $secondary_monitors; do
|
2018-08-26 16:11:25 -05:00
|
|
|
svc_log "Starting secondary on monitor $monitor"
|
|
|
|
PB_MONITOR=$monitor
|
|
|
|
polybar -r secondary& > /dev/null 2>&1
|
|
|
|
polybar -r secondary-2& > /dev/null 2>&1
|
|
|
|
done
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|