summaryrefslogtreecommitdiff
path: root/scripts/disp
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/disp')
-rwxr-xr-xscripts/disp25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/disp b/scripts/disp
new file mode 100755
index 0000000..ed33a58
--- /dev/null
+++ b/scripts/disp
@@ -0,0 +1,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"