Last active 1731166690

dominic revised this gist 1731166690. Go to revision

1 file changed, 36 insertions

xmon.sh(file created)

@@ -0,0 +1,36 @@
1 + #!/bin/sh
2 + # Practical script to adjust my monitor layout on ma X1 laptop
3 + # Dominic Reich <quick.hat4396@qtztsjosmprqmgtunjyf.com>
4 +
5 + internal="eDP-1"
6 + external="HDMI-1"
7 +
8 + print_usage () {
9 + echo >&2 "usage: $(basename ${0}) [normal;wide;dup]"
10 + exit 0
11 + }
12 +
13 + if [ $# -eq 1 ]
14 + then
15 + case "$1" in
16 + "normal"|"n"|"norm")
17 + xrandr --output "$external" --off --output "$internal" --auto
18 + dunstify "Multimonitor setup" "set to normal ($internal)"
19 + ;;
20 + "wide"|"w")
21 + xrandr --output "$external" --set audio force-dvi --mode 1920x1080
22 + xrandr --output "$internal" --auto --output "$external" --right-of "$internal"
23 + dunstify "Multimonitor setup" "set to wide ($internal + $external (right-of))"
24 + ;;
25 + "duplicate"|"dup"|"d")
26 + xrandr --output "$external" --set audio force-dvi --mode 1920x1080
27 + xrandr --output "$internal" --auto --output "$external" --same-as "$internal"
28 + dunstify "Multimonitor setup" "set to duplicate ($internal; $external)"
29 + ;;
30 + *)
31 + dunstify -u critical "Multimonitor setup failed" "no such operation: ${1}"
32 + ;;
33 + esac
34 + else
35 + print_usage
36 + fi
Newer Older