From: Stefan Huber Date: Sun, 17 Dec 2023 09:27:11 +0000 (+0100) Subject: X: Add xrandr scripts X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=336c7c24f3e51c309450450fc2e1304960a14a09;p=shutils.git X: Add xrandr scripts --- diff --git a/X/xrandr-exttomirror b/X/xrandr-exttomirror new file mode 100755 index 0000000..4f1d3ec --- /dev/null +++ b/X/xrandr-exttomirror @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +MAIN=$(xrandr | grep eDP | cut -f1 -d" ") +if [ "${MAIN}" = "" ]; then + echo "Could not find main display." + exit 1 +fi + +OTHER=$(xrandr | grep "\" | grep -v eDP | cut -f1 -d" ") +if [ "${OTHER}" = "" ]; then + echo "Could not find external display." + exit 1 +fi + +echo "Set ${MAIN} as mirror of ${OTHER}" + +xrandr --output ${OTHER} --auto --output ${MAIN} --same-as ${OTHER} --primary diff --git a/X/xrandr-exttoright b/X/xrandr-exttoright new file mode 100755 index 0000000..fca0aa6 --- /dev/null +++ b/X/xrandr-exttoright @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +MAIN=$(xrandr | grep eDP | cut -f1 -d" ") +if [ "${MAIN}" = "" ]; then + echo "Could not find main display." + exit 1 +fi + +OTHER=$(xrandr | grep "\" | grep -v eDP | cut -f1 -d" ") +if [ "${OTHER}" = "" ]; then + echo "Could not find external display." + exit 1 +fi + +echo "Bring ${OTHER} right of ${MAIN}" + +xrandr --output ${MAIN} --auto --primary; xrandr --output ${OTHER} --auto; xrandr --output ${OTHER} --auto --right-of ${MAIN} diff --git a/X/xrandr-single b/X/xrandr-single new file mode 100755 index 0000000..174a0df --- /dev/null +++ b/X/xrandr-single @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +MAIN=$(xrandr | grep eDP | cut -f1 -d" ") +if [ "${MAIN}" = "" ]; then + echo "Could not find main display." + exit 1 +fi + +echo "Set ${MAIN} as primary" +xrandr --output ${MAIN} --auto --primary + +OTHER=$(xrandr | grep "\" | grep -v eDP | cut -f1 -d" ") +if [ "${OTHER}" = "" ]; then + echo "Could not find external display." + exit 1 +fi + +echo "Set ${OTHER} off" +xrandr --output ${OTHER} --off