From baf4ded28d45d57e817e1bd5dec591348f943be6 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Mon, 15 Mar 2021 10:09:34 +0100 Subject: [PATCH] [hlwm] Script for switching displays --- scripts/hlwm-display-switch.sh | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/hlwm-display-switch.sh diff --git a/scripts/hlwm-display-switch.sh b/scripts/hlwm-display-switch.sh new file mode 100755 index 0000000..e2a4377 --- /dev/null +++ b/scripts/hlwm-display-switch.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +extern_1="HDMI1" +extern_2="DP1" +intern="eDP1" +polybar_top_padding=22 + +switch_internal() { + xrandr --output "$extern_2" --off \ + --output "$extern_1" --off \ + --output "$intern" --auto --primary + herbstclient detect_monitors + herbstclient pad 0 "$polybar_top_padding" + ~/.fehbg & + xmodmap ~/.Xmodmap +} + +switch_external() { + xrandr --output "$extern_2" --primary --auto \ + --output "$extern_1" --auto --left-of "$extern_2" \ + --output "$intern" --auto --right-of "$extern_2" + herbstclient detect_monitors + herbstclient pad 0 0 + herbstclient pad 2 0 + herbstclient pad 1 "$polybar_top_padding" + ~/.fehbg & + xmodmap ~/.Xmodmap +} + +case "$1" in + i* ) + switch_internal + ;; + e* ) + switch_external + ;; + * ) + echo "Specify new output configuration. Possibilities are: 'external' and 'internal'" + ;; +esac