scripts

scripts to make my pc work
Index Commits Files Refs
commit ca838c9abacf893324669c788a1a1cb950e22e20
parent 07e4850d017c55d04950d1fdd9a2c8b506161eec
Author: klewer-martin <martin.cachari@gmail.com>
Date:   Tue, 30 Mar 2021 00:46:55 -0300

Update;

Diffstat:
Mstatusbar/sb-battery | 8++++----
Mstatusbar/sb-clock | 2+-
Mstatusbar/sb-internet | 9+++++----
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/statusbar/sb-battery b/statusbar/sb-battery
@@ -22,9 +22,9 @@ for battery in /sys/class/power_supply/BAT?*; do
     [ -n "${capacity+x}" ] && printf " "
     # Sets up the status and capacity
     case "$(cat "$battery/status")" in
-        "Full") status="⚡: " ;;
-        "Discharging") status="🔋: " ;;
-        "Charging") status="🔌: " ;;
+        "Full") status="⚡:" ;;
+        "Discharging") status="🔋:" ;;
+        "Charging") status="🔌:" ;;
         "Not charging") status="🛑: " ;;
         "Unknown") status="♻️: " ;;
     esac
@@ -32,5 +32,5 @@ for battery in /sys/class/power_supply/BAT?*; do
     # Will make a warn variable if discharging and low
     [ "$status" = "🔋: " ] && [ "$capacity" -le 25 ] && warn="❗"
     # Prints the info
-    printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
+    printf "%s%.1s%*d%%" "$status" "$warn" "3" "$capacity"; unset warn
 done && exit 0
diff --git a/statusbar/sb-clock b/statusbar/sb-clock
@@ -27,4 +27,4 @@ esac
 #esac
 
 #date "+ %a %b %d %Y $icon: %I:%M%p"
-date "+📅: %a %d/%m/%Y | $icon: %R      "
+date "+📅: %a %d/%m/%Y | $icon: %R "
diff --git a/statusbar/sb-internet b/statusbar/sb-internet
@@ -17,13 +17,14 @@ case $BLOCK_BUTTON in
 esac
 
 case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
-    down) wifiicon="📡: " ;;
-    up) wifiicon="$(awk '/^\s*w/ { print "📶:", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
+    down) wifiicon="📡:  -%" ;;
+    up) wifiicon="$(awk '/^\s*w/ { print "📶:", int($3 * 100 / 70) "%" }' /proc/net/wireless)" ;;
 esac
 
 case "$(cat /sys/class/net/e*/operstate 2>/dev/null)" in
     down) ip="" ;;
-    up) ip="$(awk '/^\s*w/ { print "📶:", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
+    up) ip="| $(ip -o a | awk '/: e.*.inet .*/ { print $4 }' | sed 's/\// /' | awk '{ print $1 }')" ;;
+
 esac
 
-printf "%s%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)" ": ip:"
+printf "%s%s%s%s\n" "$wifiicon" "$(sed "s/down//;s/up/ /" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)" "$ip"