OSDN Git Service

add checkinternet
authorpaperbenni <paperbenni@gmail.com>
Thu, 11 Jun 2020 13:28:38 +0000 (15:28 +0200)
committerpaperbenni <paperbenni@gmail.com>
Thu, 11 Jun 2020 13:28:38 +0000 (15:28 +0200)
autostart.sh
programs/appmenu
programs/checkinternet [new file with mode: 0644]
programs/dunsttrigger
programs/instanthotkeys
programs/instantupdate
programs/instantwine

index da59bf4..a2e2f57 100755 (executable)
@@ -114,16 +114,23 @@ fi
 # fix resolution on virtual machine
 if ! iconf -i novmfix && cat /proc/cpuinfo | grep -q hypervisor; then
        if [ -e /opt/instantos/kvm ]; then
-               iconf -i doubledraw 1
-               if ! iconf -i potato && ! iconf -i nopotato; then
-                       if echo "picom requires GPU passthrough to to proper transparency on KVM
-Disable it for this VM?" | imenu -C; then
-                               iconf -i potato 1
-                       else
-                               if ! imenu -c "ask again next time?"; then
-                                       iconf -i nopotato 1
+               iconf -i highfps 1
+               if lshw -c video | grep qxl && xrandr | grep '^xql'; then
+                       iconf -i qxl 1
+                       # iconf -i noanimations 1
+                       if ! iconf -i potato && ! iconf -i nopotato; then
+                               if echo "please set your graphics to virtio on KVM
+Otherwise picom and st will not function properly
+Disable compositing for this VM?" | imenu -C; then
+                                       iconf -i potato 1
+                               else
+                                       if ! imenu -c "ask again next time?"; then
+                                               iconf -i nopotato 1
+                                       fi
                                fi
                        fi
+               else
+                       iconf -i qxl 1
                fi
        fi
        if echo "virtual machine detected.
@@ -156,13 +163,13 @@ if [ -z "$ISLIVE" ]; then
                autorandr instantos &
        fi
 
-       if ping archlinux.org -c 2; then
+       if checkinternet; then
                onlinetrigger
        else
                # fall back to already installed wallpapers
                instantwallpaper offline
                for i in $(seq 10); do
-                       if ping archlinux.org -c 2; then
+                       if checkinternet; then
                                onlinetrigger
                                break
                        else
@@ -214,10 +221,6 @@ else
        sleep 1
 fi
 
-if iconf -i highfps; then
-       xdotool key super+alt+shift+d
-fi
-
 # make built in status optional
 if ! iconf -i nostatus; then
        source /usr/bin/instantstatus &
@@ -261,10 +264,12 @@ if ! iconf -i norootinstall && [ -z "$ISLIVE" ]; then
        fi
 fi
 
-# doubledraw enables higher refresh rates
-# and speeds up animations
-if iconf -i doubledraw; then
-       xdotool key Super+Alt+Shift+D
+if iconf -i highfps; then
+       xdotool key super+alt+shift+d
+fi
+
+if iconf -i noanimations; then
+       xdotool key super+alt+shift+s
 fi
 
 # desktop icons
index 0f8a88b..1172c82 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/dash
 if ! [ -e ~/.config/instantos/israspi ]; then
-       if [ -e /opt/instantos/kvm ]; then
+       if [ -e /opt/instantos/kvm ] && iconf -i qxl; then
                instantmenu_path | instantmenu -l 10 -c "$@" | ${SHELL:-"/bin/bash"} &
        else
                rofi -show drun -modi drun -theme /usr/share/instantdotfiles/rofi/appmenu.rasi -me-select-entry '' -me-accept-entry 'MousePrimary'
diff --git a/programs/checkinternet b/programs/checkinternet
new file mode 100644 (file)
index 0000000..23e5b77
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# quick utility to check for internet access
+
+if timeout 10 ping -q -c 1 -W 1 8.8.8.8 &>/dev/null; then
+    exit 0
+else
+    echo "internet access is unreliable or not working"
+    exit 1
+fi
index e8838c0..63bb327 100755 (executable)
@@ -10,7 +10,7 @@ fi
 # some apps dont need/already have notification sounds
 if ! echo "$1" | grep -Eiq '(discord|spotify|thunderbird|mailspring)' && ! iconf -i mutenotifications; then
     if ! [ -e ~/instantos/notifications/notification.ogg ]; then
-        if ping -c 1 archlinux.org; then
+        if checkinternet; then
             mkdir -p ~/instantos/notifications/
             wget -qO ~/instantos/notifications/notification.ogg \
                 "https://notificationsounds.com/notification-sounds/me-too-603/download/ogg"
index 9bdad7e..0af02a6 100755 (executable)
@@ -3,7 +3,7 @@
 # Show a list of available key bindings
 
 dlbinds() {
-    if ping -c 1 archlinux.org; then
+    if checkinternet; then
         curl -s 'https://raw.githubusercontent.com/instantOS/instantos.github.io/master/youtube/hotkeys.md' |
             sed 's/^\([^|#]\)/    \1/g' |
             sed 's/^##*[ ]*/ /g' >~/.cache/instantos/hotkeys.md
index f56006e..93f6658 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-if ! ping -c 1 archlinux.org &>/dev/null; then
+if ! checkinternet; then
     echo "internet is required to upgrade instantOS"
     exit 1
 fi
index 795ad7c..ddbfc5d 100755 (executable)
@@ -7,7 +7,7 @@ else
     exit
 fi
 
-if ! ping -c 1 archlinux.org; then
+if ! checkinternet; then
     echo "internet is required"
     exit
 fi