32 lines
818 B
Plaintext
32 lines
818 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.
|
||
|
#
|
||
|
|
||
|
source $DTF_SERVICES_DIR/common.bash
|
||
|
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
|
||
|
}
|
||
|
|