summaryrefslogtreecommitdiff
path: root/scripts/disp
blob: ed33a585c32dfa2f63a624387708175f9f50a950 (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
#!/bin/sh

set -e

temp="$(mktemp)"
xrandr -q > "$temp"
awk '
    BEGIN {
        printf "xrandr "
    }
    $2 == "connected" { 
        what = $1
        res = "" 
    }
    /^   [0-9]/ && what != "" { 
        printf "--output %s --mode %s ", what, $1
        if (what == "LVDS1") printf "--same-as VGA1 "
        what ="" 
    }
    END {
        printf "\n"
    }
' "$temp" | sh

rm -f "$temp"