aboutsummaryrefslogtreecommitdiff
path: root/Scripts/.local/scripts/set_bar
diff options
context:
space:
mode:
authordx <aryadevchavali1@gmail.com>2020-05-12 22:06:42 +0100
committerdx <aryadevchavali1@gmail.com>2020-05-12 22:06:42 +0100
commitceaa91c43e11cd57d1c90f5a581d03ed8bef874d (patch)
treec41559c1e865d04dde7014bfd5b0220cf5061e85 /Scripts/.local/scripts/set_bar
parentf3d34eed3f3054e1ff1bbb8424d2344393add335 (diff)
downloaddotfiles-ceaa91c43e11cd57d1c90f5a581d03ed8bef874d.tar.gz
dotfiles-ceaa91c43e11cd57d1c90f5a581d03ed8bef874d.tar.bz2
dotfiles-ceaa91c43e11cd57d1c90f5a581d03ed8bef874d.zip
+scripts to version control
Stored in .local/scripts, scripts I use for my init. I will be adding my xinit shortly for a full experience.
Diffstat (limited to 'Scripts/.local/scripts/set_bar')
-rwxr-xr-xScripts/.local/scripts/set_bar64
1 files changed, 64 insertions, 0 deletions
diff --git a/Scripts/.local/scripts/set_bar b/Scripts/.local/scripts/set_bar
new file mode 100755
index 0000000..5141bb9
--- /dev/null
+++ b/Scripts/.local/scripts/set_bar
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+delimiter=' | '
+
+timedate() {
+ echo $(date +'%a %F %R')
+}
+
+battery() {
+ capacity=$(cat /sys/class/power_supply/BAT0/capacity) || break
+ status=$(cat /sys/class/power_supply/BAT0/status)
+
+ if [[ $status == "Charging" ]]
+ then
+ status=""
+ else
+ if [[ $capacity -ge 75 ]]
+ then
+ status=""
+ elif [[ $capacity -ge 50 ]]
+ then
+ status=""
+ elif [[ $capacity -ge 25 ]]
+ then
+ status=""
+ elif [[ $capacity -ge 10 ]]
+ then
+ status=""
+ else
+ status=""
+ fi
+ fi
+ echo "$status $capacity%"
+}
+
+volume() {
+ sinks="$(pactl list sinks)"
+ vol="$(echo "$sinks" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
+
+ if [[ $vol -gt 50 ]]
+ then
+ icon=""
+ elif [[ $vol -gt 10 ]]
+ then
+ icon=""
+ else
+ icon=""
+ fi
+
+ echo "$icon $vol%"
+}
+
+ram() {
+ echo $(vmstat -s -a -S M | grep 'used memory' | grep -Po "\d+")M
+}
+
+disk() {
+ echo $(df | grep /dev/sda2 | awk '{print $5}')
+}
+
+while true; do
+ xsetroot -name "Meme level at $(disk) $delimiter $(ram) $delimiter $(volume) $delimiter $(battery) $delimiter $(timedate)"
+ sleep 30s;
+done