#!/bin/bash # chgMon.sh / Richard Borwinius / 2016 # kleines Skript um die Monitoreinstellungen initial zu ändern, # wenn zwei Monitore vorhanden sind # erforderliche Programme: xrandr, zenity, bash(nicht nur sh!) # Bei Aufruf von "chgMon.sh 2" und zwei angeschlossenen Monitoren wird automatisch xinerama eingestellt buf=(`xrandr 2>/dev/null | grep " connected" | cut -d " " -f1`) echo angeschlossene Monitore ${#buf[*]} ? if [ ${#buf[*]} -eq 2 ]; then if [ $1 -eq 2 ]; then xrandr --output ${buf[0]} --auto --left-of ${buf[1]} --auto exit 0; fi zenity --question --text "Sollen die Monitoreinstellungen jetzt geändert werden?" || exit; auswahl=`zenity --list --radiolist --width=400 --height=400\ --title "Anzeige ändern" \ --text "Wählen Sie die Monitoreinstellungen jetzt aus." \ --column="" --column="" --column="Einstellungen" \ "" "1" "Ausgabe auf Monitor 1" \ "" "2" "Ausgabe auf Monitor 2" \ "" "3" "Xinerama rechts <-> links" \ "" "4" "Xinerama links <-> rechts" \ "" "5" "Monitore Klonen";` echo $? if [ -z "$auswahl" ] ; then auswahl=0 echo Abbruch fi if [ $auswahl -eq 1 ] then xrandr --output ${buf[0]} --auto --output ${buf[1]} --off fi if [ $auswahl -eq 2 ] then xrandr --output ${buf[0]} --off --output ${buf[1]} --auto fi if [ $auswahl -eq 3 ] then xrandr --output ${buf[0]} --auto --left-of ${buf[1]} --auto fi if [ $auswahl -eq 4 ] then xrandr --output ${buf[1]} --auto --left-of ${buf[0]} --auto fi if [ $auswahl -eq 5 ] then xrandr --output ${buf[0]} --auto --output ${buf[1]} --same-as ${buf[0]} --auto fi fi