Advertisement
lluks420

launch.sh

Apr 27th, 2021
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ## Add this to your wm startup file.
  4.  
  5. # Terminate already running bar instances
  6. killall -q polybar
  7.  
  8. # Wait until the processes have been shut down
  9. while pgrep -u $UID -x polybar >/dev/null; do sleep 0.5; done
  10.  
  11. # Get all active monitor-connections
  12. monitors=$(xrandr --listactivemonitors | awk '!/Monitors/ {print $4}')
  13. if [[ $(xrandr --listactivemonitors | awk '!/Monitors/ {print $4}' | grep DP-2) == "DP-2" ]]; then
  14. MAIN_MONITOR=DP-2
  15. else
  16. MAIN_MONITOR=HDMI-0
  17. fi
  18.  
  19. MONITOR=${MAIN_MONITOR} polybar -c ~/.config/polybar/config.ini main &
  20. for m in $(xrandr --query | grep " connected " | cut -d" " -f1 | grep -v ${MAIN_MONITOR}); do
  21. MONITOR=$m polybar -c ~/.config/polybar/config.ini secondary &
  22. done
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement