#!/bin/bash set -x PLACE=$1 #xrandr | grep -A1 'DisplayPort.* connected' | while read -r display #do # echo $display | tail -n1 | grep 2560 # if [ $? -eq 0 ] # then # WQHD=$(echo $display | head -n1 | cut -d" " -f1) # else # FULLHD=$(echo $display | head -n1 | cut -d" " -f1) # fi #done INTERNAL=$(xrandr | grep eDP | cut -d' ' -f1) QUADHD_RIGHT=DisplayPort-0 QUADHD_LEFT=DisplayPort-1 #deactivate() case $PLACE in single) for display in $(xrandr --query | grep -v ' connected' | cut -d' ' -f1) do if [ $display == "eDP" ] then true else xrandr --output "${display}" --off fi done xrandr --output "${INTERNAL}" --auto --primary systemctl --user restart polybar@main.service systemctl --user stop polybar@quadhd_left.service systemctl --user stop polybar@quadhd_right.service ;; home) xrandr --output "${INTERNAL}" --off xrandr --output "${QUADHD_LEFT}" --auto --primary xrandr --output "${QUADHD_RIGHT}" --auto --right-of "${QUADHD_LEFT}" systemctl --user stop polybar@main.service systemctl --user restart polybar@quadhd_left.service systemctl --user restart polybar@quadhd_right.service ;; home-single) xrandr --output "${INTERNAL}" --off xrandr --output "${QUADHD_RIGHT}" --off xrandr --output "${QUADHD_LEFT}" --auto --primary systemctl --user stop polybar@main.service systemctl --user restart polybar@quadhd_left.service systemctl --user stop polybar@quadhd_right.service ;; esac