a few important fixes, mostly improvements
[distro-setup] / system-status
index d6269d9c825f89b30a67cc5cb7e1f3512f278dfa..ae37d3b02cf26782d07ac1a90019403d0c1699d0 100755 (executable)
@@ -440,32 +440,30 @@ mute() {
   local locked
   export DISPLAY=:0
   locked=false
-  if lock_info=$(xscreensaver-command -time); then
+  if lock_info=$(xscreensaver-command -time 2>/dev/null); then
     if [[ $lock_info != *non-blanked* ]]; then
       locked=true
     fi
-  else
-    locked=true
-  fi
-  midnight=$(date -d 00:00 +%s)
-  mdiff=$(( EPOCHSECONDS - midnight ))
-  if $locked && (( mdiff < 6 *60*60 || mdiff > 21 *60*60 )); then
-    case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
-      no)
-        # for log purposes
-        echo muted
-        pactl set-sink-mute @DEFAULT_SINK@ true
-        ;;
-    esac
-  fi
-  if ! $locked && ((  mdiff > 6 *60*60 || mdiff < 12 *60*60 )) && [[ ! -e /tmp/ianknap ]]; then
-    case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
-      yes)
-        # for log purposes
-        echo unmuted
-        pactl set-sink-mute @DEFAULT_SINK@ false
-        ;;
-    esac
+    midnight=$(date -d 00:00 +%s)
+    mdiff=$(( EPOCHSECONDS - midnight ))
+    if $locked && (( mdiff < 6 *60*60 || mdiff > 21 *60*60 )); then
+      case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
+        no)
+          # for log purposes
+          echo muted
+          pactl set-sink-mute @DEFAULT_SINK@ true
+          ;;
+      esac
+    fi
+    if ! $locked && ((  mdiff > 6 *60*60 || mdiff < 12 *60*60 )) && [[ ! -e /tmp/ianknap ]]; then
+      case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
+        yes)
+          # for log purposes
+          echo unmuted
+          pactl set-sink-mute @DEFAULT_SINK@ false
+          ;;
+      esac
+    fi
   fi
 }