OSDN Git Service

fix nvidia card display lag
authorpaperbenni <paperbenni@gmail.com>
Sun, 30 Aug 2020 20:47:04 +0000 (22:47 +0200)
committerpaperbenni <paperbenni@gmail.com>
Sun, 30 Aug 2020 20:47:04 +0000 (22:47 +0200)
autostart.sh

index 4aa3e4f..03bd873 100755 (executable)
@@ -311,7 +311,14 @@ done &
 
 # auto open menu when connecting/disconnecting monitor
 if ! (iconf -i noautoswitch && iconf -i islaptop) || iconf -i autoswitch; then
-    DISPLAYCOUNT="$(xrandr | grep -c '[^s]connected')"
+
+    if nvidia-xconfig --query-gpu-info
+    then
+        DISPLAYCOUNT="$(nvidia-xconfig --query-gpu-info | grep -oi 'number of dis.*' | grep -o '[0-9]*')"
+    else
+        DISPLAYCOUNT="$(xrandr | grep -c '[^s]connected')"
+    fi
+
     if [ "$DISPLAYCOUNT" -eq "$DISPLAYCOUNT" ]; then
         while :; do
             NEWDISPLAYCOUNT="$(xrandr | grep -c '[^s]connected')"