GitBucket
Pull requests
Issues
Snippets
Sign in
yuuji
/
vga.sh
Fork
0
Created at Sat May 26 18:51:31 JST 2018
Download ZIP
HTTP
Embed
Embed this snippet in your website.
HTTP
Clone with Git using the repository's web address.
Code
Revision
Forks
HIROSE Yuuji
revised this
on 26 May 2018
69c1393
vga.sh
#!/bin/sh mode=1024x768 while getopts m:l i; do case $i in m) mode=$OPTARG ;; l) lvdsmode=1 ;; esac done shift $((OPTIND - 1)) vdevs=`xrandr | grep -wi 'connected' | awk '{print $1}'` vdevs=`echo $vdevs` count=`echo $vdevs | wc -w` lvds=${vdevs%% *} vga=${vdevs##* } if [ -n "$lvdsmode" -o $count -lt 2 ]; then mode=`xrandr|grep +|grep -v conn|head -1|awk '{print $1}'` if [ x"$lvds" = x"$vga" ]; then vga=`xrandr|grep 'disconnected .*[0-9]x[1-9]'|head -1|awk '{print $1}'` fi xrandr --output $vga --off xrandr --output $lvds --mode $mode exit 0 fi xrandr --output $vga --mode $mode xrandr --output $lvds --mode $mode xrandr --output $vga --same-as $lvds