Parcourir la Source

~/.bin/select-display: Switch between displays easily

For now it's a manual selection of outputs and modes, but it works well
enough.
Lucas Stadler 8 ans auparavant
Parent
commit
1d168d0899
1 fichiers modifiés avec 32 ajouts et 0 suppressions
  1. 32 0
      .bin/select-display

+ 32 - 0
.bin/select-display

@ -0,0 +1,32 @@
1
#!/bin/sh
2
3
# TODO:
4
#
5
# - parse maximum resolution from xrandr output
6
7
options="$(xrandr | sed -nE 's/^(\w+) connected.*$/\1/p')"
8
options="$options
9
auto"
10
11
display="$1"
12
if [ -z "$display" ]; then
13
	display="$(echo "$options" | zenity --list --text "Select a display to project to:" --column Display)"
14
fi
15
16
case "$display" in
17
	"")
18
		# don't change anything
19
		;;
20
	"auto")
21
		xrandr --auto
22
		;;
23
	LVDS1)
24
		xrandr --output LVDS1 --mode 1366x768 --output DP1 --off
25
		;;
26
	DP1)
27
		xrandr --output LVDS1 --off           --output DP1 --mode 2560x1440
28
		;;
29
	*)
30
		xrandr --error --text "Don't know how to handle '$display'"
31
		;;
32
esac