blob: 82b5f7d1b88828c687f79d173fb6045048f2145d (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
#
# ██████████ ██████ ███████
# ░░██░░██░░██ ██░░░░██░░██░░░██
# ░██ ░██ ░██░██ ░██ ░██ ░██
# ░██ ░██ ░██░██ ░██ ░██ ░██
# ███ ░██ ░██░░██████ ███ ░██
# ░░░ ░░ ░░ ░░░░░░ ░░░ ░░
#
usage() {
echo "usage: $(basename $0) [-lr <id>]\n -l list monitor ids\n -r get resolution by id\n" >&2
exit 1
}
list() {
mons=`xrandr | grep -e "^.* connected" | cut -d " " --field "1"`
for mon in $mons; do
echo "$mon"
done
}
res() {
[ -z $1 ] && usage
res=`xrandr\
| grep -e "^$1 connected"\
| cut --delimiter=' ' --fields='3'\
| sed "s/[x\+]/ /g"`
echo $res
}
while getopts "lr:" opt
do
case $opt in
# list
l)
list
;;
# res
r)
res $OPTARG
;;
*)
usage
;;
esac
done
[ -z $1 ] && usage
|