X-Git-Url: https://git.sthu.org/?p=shutils.git;a=blobdiff_plain;f=X%2Fxrandr-exttomirror;fp=X%2Fxrandr-exttomirror;h=4f1d3ec4c000874944e4730f00a2530d231fb99e;hp=0000000000000000000000000000000000000000;hb=336c7c24f3e51c309450450fc2e1304960a14a09;hpb=9b52797ddadf989219c0f1677ee4f403a1e31030 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