OSDN Git Service

better internet check
[instantos/instantOS.git] / programs / instantmouse
index 3e7f535..cbad4aa 100755 (executable)
@@ -21,7 +21,19 @@ g*)
 s*)
     # set sensitivity
     while read -r line; do
-        xinput set-prop $line "libinput Accel Speed" "${2:--0.4}"
+        xinput set-prop "$line" "libinput Accel Speed" "${2:--0.4}"
+    done <<<"$(iconf mouse)"
+    ;;
+m*)
+    # set sensitivity but map volume from 0 to 100
+    if [ -n "$2" ]; then
+        SENSITIVITY=$(echo "( $2 / 50 ) - 1" | bc -l)
+    else
+        SENSITIVITY="-.04"
+    fi
+
+    while read -r line; do
+        xinput set-prop "$line" "libinput Accel Speed" "$SENSITIVITY"
     done <<<"$(iconf mouse)"
     ;;
 z)
@@ -32,9 +44,13 @@ z)
 
     if [ -e /tmp/zeromouse ]; then
         rm /tmp/zeromouse
-        instantmouse s "$(iconf mousespeed)"
+        while read -r line; do
+            xinput --enable "$line"
+        done <<<"$(iconf mouse)"
     else
-        instantmouse s -1
+        while read -r line; do
+            xinput --disable "$line"
+        done <<<"$(iconf mouse)"
         touch /tmp/zeromouse
     fi
 
@@ -51,14 +67,14 @@ r*)
     if iconf -i reversemouse; then
         iconf -i reversemouse 0
         while read -r line; do
-            xinput set-prop $line "libinput Natural Scrolling Enabled" "0"
+            xinput set-prop "$line" "libinput Natural Scrolling Enabled" "0"
         done <<<"$(iconf mouse)"
         echo "reverse scrolling disabled"
     else
         iconf -i reversemouse 1
         echo "reverse scrolling enabled"
         while read -r line; do
-            xinput set-prop $line "libinput Natural Scrolling Enabled" "1"
+            xinput set-prop "$line" "libinput Natural Scrolling Enabled" "1"
         done <<<"$(iconf mouse)"
     fi
     ;;