blob: 5495b6c36b0410207d66d04f5fc0aa8ce2940e20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/bash
#
# Wrapper around xrandr to set screen resolution.
#
# Parameters
BASENAME="`basename $0`"
X="$1"
Y="$2"
# Check
if [ -z "$Y" ]; then
echo "usage: $BASENAME <x-res> <y-res>"
exit 1
elif ! which cvt &> /dev/null; then
echo "please install cvt from xserver-xorg-core"
exit 1
elif ! which xrandr &> /dev/null; then
echo "please install xrandr from x11-xserver-utils"
exit 1
fi
# Get modeline and interface
MODELINE="`cvt $X $Y | grep -v '^#' | sed -e 's/^Modeline //'`"
INTERFACE="`xrandr | grep " connected" | cut -d ' ' -f 1 | head`"
NAME="`echo $MODELINE | cut -d ' ' -f 1 | sed -e 's/"//g'`"
# Apply
xrandr --newmode $MODELINE &> /dev/null
xrandr --addmode $INTERFACE $NAME
xrandr --output $INTERFACE --mode $NAME
|