scripts

scripts to make my pc work
Index Commits Files Refs
commit 07e4850d017c55d04950d1fdd9a2c8b506161eec
parent 223f584e8cc9ccd3387d941c24c99fb059f1cee9
Author: klewer-martin <martin.cachari@gmail.com>
Date:   Fri, 26 Mar 2021 23:31:38 -0300

Update: Added custom version of luke smith scripts for dwmblocks

Diffstat:
Mstatusbar/sb-battery | 12++++++------
Mstatusbar/sb-clock | 2+-
Mstatusbar/sb-internet | 11++++++++---
Mstatusbar/sb-memory | 2+-
Mstatusbar/sb-nettraf | 3++-
Mstatusbar/sb-pacpackages | 2+-
Mstatusbar/sb-volume | 8+++++---
7 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/statusbar/sb-battery b/statusbar/sb-battery
@@ -22,15 +22,15 @@ 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="🔌" ;;
-        "Not charging") status="🛑" ;;
-        "Unknown") status="♻️" ;;
+        "Full") status="⚡: " ;;
+        "Discharging") status="🔋: " ;;
+        "Charging") status="🔌: " ;;
+        "Not charging") status="🛑: " ;;
+        "Unknown") status="♻️: " ;;
     esac
     capacity=$(cat "$battery/capacity")
     # Will make a warn variable if discharging and low
-    [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
+    [ "$status" = "🔋: " ] && [ "$capacity" -le 25 ] && warn="❗"
     # Prints the info
     printf "%s%s%d%%" "$status" "$warn" "$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,8 +17,13 @@ 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
 
-printf "%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)"
+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)" ;;
+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:"
diff --git a/statusbar/sb-memory b/statusbar/sb-memory
@@ -9,4 +9,4 @@
 #    6) "$TERMINAL" -e "$EDITOR" "$0" ;;
 #esac
 
-free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠: %2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
+free --mebi | sed -n '2{p;q}' | awk '{printf (" 🧠: %2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
diff --git a/statusbar/sb-nettraf b/statusbar/sb-nettraf
@@ -26,4 +26,5 @@ update() {
 rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
 tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
 
-printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
+#printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
+printf "🔻%4sB\\n" $(numfmt --to=iec $rx)
diff --git a/statusbar/sb-pacpackages b/statusbar/sb-pacpackages
@@ -26,4 +26,4 @@ case $BLOCK_BUTTON in
     6) "$TERMINAL" -e "$EDITOR" "$0" ;;
 esac
 
-pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g"
+pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦: /;s/^📦0$//g"
diff --git a/statusbar/sb-volume b/statusbar/sb-volume
@@ -13,17 +13,19 @@
 #     6) "$TERMINAL" -e "$EDITOR" "$0" ;;
 # esac
 
-[ $(pamixer --get-mute) = true ] && echo 🔇 && exit
+[ $(pamixer --get-mute) = true ] && echo "🔇:  0%" && exit
 
 vol="$(pamixer --get-volume)"
 
 if [ "$vol" -gt "50" ]; then
     icon="🔊"
+elif [ "$vol" -eq "0" ]; then
+    icon="🔇"
 elif [ "$vol" -lt "25" ]; then
     icon="🔈"
 else
     icon="🔉"
 fi
 
-#echo "$icon: $vol%"
-echo "VOL: $vol%"
+echo "$icon: $vol%"
+#echo "VOL: $vol%"