From 336c7c24f3e51c309450450fc2e1304960a14a09 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Sun, 17 Dec 2023 10:27:11 +0100 Subject: [PATCH] X: Add xrandr scripts --- X/xrandr-exttomirror | 19 +++++++++++++++++++ X/xrandr-exttoright | 19 +++++++++++++++++++ X/xrandr-single | 21 +++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100755 X/xrandr-exttomirror create mode 100755 X/xrandr-exttoright create mode 100755 X/xrandr-single 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 -- 2.39.5