Redesign component interfaces
[khatus.git] / bin / khatus_sensor_screen_brightness
index 08a8dfc..9b075d3 100755 (executable)
@@ -4,7 +4,15 @@ set -e
 
 screen_brightness_device_path="$1"
 
-echo "\
-    $(cat $screen_brightness_device_path/max_brightness) \
-    $(cat $screen_brightness_device_path/brightness)\
-"
+awk '
+    BEGIN {
+        OFS = msg_fs ? msg_fs : "|"
+        Kfs = key_fs ? key_fs : ":"
+    }
+
+    FILENAME ~ "/max_brightness$" {max = $1; next}
+    FILENAME ~     "/brightness$" {cur = $1; next}
+    END                           {print("percentage", (cur / max) * 100)}
+' \
+"$screen_brightness_device_path/max_brightness" \
+"$screen_brightness_device_path/brightness"
This page took 0.028255 seconds and 4 git commands to generate.