[PATCH] determine resolution with xdpyinfo instead of xrandr
Hi
Please accept the following patch for live-startscripts that uses
xdpyinfo instead of xrandr to determine the screen resolution. I have
seen xrandr fail on some systems (e.g. Asus K401J) with the following
error message:
xrandr: Output Unknown-2 is not disconnected but has no modes
OTOH, xdpyinfo seems to work always.
Regards
Ronny
--
Ronny Standtke Fachhochschule Nordwestschweiz
Dozent Medienpädagogik / ICT Pädagogische Hochschule
Telefon: +41 32 627 92 47 Obere Sternengasse 7
Mobil : +41 79 786 81 82 4502 Solothurn
diff --git a/functions/resolution.sh b/functions/resolution.sh
index 673c81d..6cc166e 100755
--- a/functions/resolution.sh
+++ b/functions/resolution.sh
@@ -1,9 +1,19 @@
#!/bin/sh
-_RESOLUTION="$(xrandr)"
+#################################################################
+# xrandr failed on Asus K401J with error message: #
+# xrandr: Output Unknown-2 is not disconnected but has no modes #
+# therefore we use now xdpyinfo (see below) #
+#################################################################
+#_RESOLUTION="$(xrandr)"
+#
+#read x x x x x x x _RESOLUTION_X x _RESOLUTION_Y x << EOF
+#${_RESOLUTION}
+#EOF
+#
+#_RESOLUTION_Y="${_RESOLUTION_Y%,}"
-read x x x x x x x _RESOLUTION_X x _RESOLUTION_Y x << EOF
-${_RESOLUTION}
-EOF
-
-_RESOLUTION_Y="${_RESOLUTION_Y%,}"
+#################################################################
+# this version with with xdpyinfo seems to be more reliable #
+#################################################################
+eval $(LC_ALL=C; xdpyinfo | grep dimensions | awk '{print $2}' | awk -Fx '{print "_RESOLUTION_X=" $1 " _RESOLUTION_Y=" $2}')
Reply to: