]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
add basic awk scripts
authorStefan Tomanek <stefan@pico.ruhr.de>
Tue, 26 Oct 2010 14:15:57 +0000 (16:15 +0200)
committerStefan Tomanek <stefan@pico.ruhr.de>
Tue, 26 Oct 2010 14:15:57 +0000 (16:15 +0200)
conf.awk [new file with mode: 0644]
fp.awk [new file with mode: 0644]

diff --git a/conf.awk b/conf.awk
new file mode 100644 (file)
index 0000000..f7df401
--- /dev/null
+++ b/conf.awk
@@ -0,0 +1,18 @@
+#!/usr/bin/awk
+
+/^[^ ]+ disconnected / {
+       OUTPUT[$1] = "--off";
+}
+
+/^[^ ]+ connected / {
+       split($3, A, "+");
+       OUTPUT[$1] = "--mode "A[1]" --pos "A[2]"x"A[3];
+}
+
+END {
+       printf "xrandr ";
+       for (O in OUTPUT) {
+               printf "--output " O " " OUTPUT[O] " ";
+       }
+       printf "\n";
+}
diff --git a/fp.awk b/fp.awk
new file mode 100644 (file)
index 0000000..5d0f497
--- /dev/null
+++ b/fp.awk
@@ -0,0 +1,15 @@
+#!/usr/bin/awk
+/^[^ ]+ (dis)?connected / {
+       DEV=$1;
+       ID[DEV] = "";
+}
+
+$1 ~ /^[a-f0-9]+$/ {
+       ID[DEV] = ID[DEV] $1
+}
+
+END {
+       for (X in ID) {
+               print X " " ID[X];
+       }
+}