xmon.sh
· 1.1 KiB · Bash
Eredeti
#!/bin/sh
# Practical script to adjust my monitor layout on ma X1 laptop
# Dominic Reich <quick.hat4396@qtztsjosmprqmgtunjyf.com>
internal="eDP-1"
external="HDMI-1"
print_usage () {
echo >&2 "usage: $(basename ${0}) [normal;wide;dup]"
exit 0
}
if [ $# -eq 1 ]
then
case "$1" in
"normal"|"n"|"norm")
xrandr --output "$external" --off --output "$internal" --auto
dunstify "Multimonitor setup" "set to normal ($internal)"
;;
"wide"|"w")
xrandr --output "$external" --set audio force-dvi --mode 1920x1080
xrandr --output "$internal" --auto --output "$external" --right-of "$internal"
dunstify "Multimonitor setup" "set to wide ($internal + $external (right-of))"
;;
"duplicate"|"dup"|"d")
xrandr --output "$external" --set audio force-dvi --mode 1920x1080
xrandr --output "$internal" --auto --output "$external" --same-as "$internal"
dunstify "Multimonitor setup" "set to duplicate ($internal; $external)"
;;
*)
dunstify -u critical "Multimonitor setup failed" "no such operation: ${1}"
;;
esac
else
print_usage
fi
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 |
37 |