31 lines
781 B
Plaintext
31 lines
781 B
Plaintext
|
#! /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
|
||
|
for monitor in $secondary monitors; do
|
||
|
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
|
||
|
}
|
||
|
|