aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-29 20:32:35 +0530
committerVidhu Kant Sharma <bokuwakanojogahoshii@yahoo.com>2020-11-29 20:32:35 +0530
commitbcadd3e7e7f8f8fb77eb4ee4817a7bf92cead858 (patch)
tree93467688394488acc9c1a27042f684bd68409fe4
parenta7d5482ded452602794e18a29eef0a770224b533 (diff)
added a baraction script for another lemonbar
-rwxr-xr-xXMonad/baraction47
1 files changed, 47 insertions, 0 deletions
diff --git a/XMonad/baraction b/XMonad/baraction
new file mode 100755
index 00000000..7a528496
--- /dev/null
+++ b/XMonad/baraction
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+DATETIME=`date +"%d %b(%A) %H:%M"`
+
+get_cpu_load() {
+ read cpu a b c previdle rest < /proc/stat
+ prevtotal=$((a+b+c+previdle))
+ sleep 0.5
+ read cpu a b c idle rest < /proc/stat
+ total=$((a+b+c+idle))
+ cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
+ echo -e "CPU: $cpu%"
+}
+
+get_cpu_temp() {
+ CEL=$'\xc2\xb0C'
+ temp=$( cat /sys/devices/virtual/thermal/thermal_zone0/temp )
+ temp=`expr $temp / 1000`
+ echo "TEMP: " $temp$CEL
+}
+
+get_disk_usage() {
+ root=$(df -h / | awk 'NR==2 {print $4 "/" $2}')
+ home=$(df -h /home | awk 'NR==2 {print $4 "/" $2}')
+ echo "ROOT:" $root " %{B-}" "%{B#E6739F} HOME:" $home " "
+}
+
+get_mem_usage() {
+ mem=$(free -m | grep Mem: | awk '{print$3 / $2 * 100}')
+ printf "MEM: %.0f %%" $mem
+}
+
+get_mute_status() {
+ vol=$(pamixer --get-volume-human)
+ if [ $vol == "muted" ]
+ then
+ echo "muted"
+ else
+ echo "not muted"
+ fi
+}
+
+while :
+do
+ echo "%{B#FD3A69}%{F#232627} " $(get_disk_usage) "%{B-} %{B#FECD1A} " $(get_cpu_load) "%{B-} %{B#03C4A1}" $(get_cpu_temp) "%{B-} %{B#FA26A0}" $(get_mem_usage) "%{B-}%{F-}%{r}%{B#6F4A8E}" $(get_mute_status) "%{B-} %{B#892CDC}%{F#FCFCFC} " ${DATETIME} " %{F-}%{B-}"
+ sleep 5
+done