commit 40d1eb80ac0d9e8b98b37ecf304beed593667d6d
Author: efe <[email protected]>
Date: Sun Dec 2 15:19:43 2018 -0500
dwm/status_bar edit and add helper shell functions
diff --git a/dwm.suckless.org/status_monitor/index.md
b/dwm.suckless.org/status_monitor/index.md
index b9af8485..fa370dd0 100644
--- a/dwm.suckless.org/status_monitor/index.md
+++ b/dwm.suckless.org/status_monitor/index.md
@@ -66,32 +66,40 @@ Feel free to add your own status monitors here (keeping the
list sorted).
Helper Functions In The Shell
-----------------------------
-Return battery capacity percentage:
+Return the battery capacity percentage:
- $(echo $(awk '/rem/ { print $3/89000 }' /proc/acpi/battery/BAT0/state|
hoc| cut -c3,4)%
+ cat /sys/class/power_supply/BAT0/capacity
-Your battery may be called something different, so check /proc/acpi for its
name. Also, change 89000 to whatever the capacity is for your battery. This
returns the remaining battery power as a percentage.
-hoc comes from plan9port or 9base.
+Alternatively you can use `acpi -b`. For older systems you can get
+the battery capacity from `/proc/acpi/battery/BAT0/state`.
-Depending on your system, you can also use
+Return the amount of ram used:
- cat /sys/class/power_supply/BAT0/capacity
+ free -h | awk '(NR==2){ print $3 }'
+
+Return the temperature of the cpu:
+
+ sed 's/000$/°C/' /sys/class/thermal/thermal_zone0/temp
+
+Alternatively you can use `acpi -t` or `sensors` from lm-sensors
+package. For older systems you can get the cpu temperature from
+`/proc/acpi/thermal_zone/THM0/temperature`
-to get your battery status in percentage.
+Return the volume for Master audio device:
-Return the amount of ram used, in megabytes:
+ amixer get Master | awk -F'[][]' 'END{ print $4":"$2 }'
- $(free -m |awk '/cache:/ { print $3"M" }')
+Return the keyboard layout:
-Return the temperature of the cpu, in degree celcius:
+ setxkbmap -query | awk '/layout/{ print $2 }'
- $(awk '{ print $2 }' /proc/acpi/thermal_zone/THM0/temperature)C
+Return the empty disk space at /home mount point:
-Return volume:
+ df -h | awk '{ if ($6 == "/home") print $4 }'
- amixer get Front | tail -n1 | awk '{ print $5 }' | tr -d []
+Return the wifi status for interface wlp3s0:
-Change “Front” to your audio device
+ cat /sys/class/net/wlp3s0/opestate
Using shell scripts very well leads to big scripts, which pull in unneeded
dependencies. One solution for this is to write everything in C, which is much