From dfcc303e7cc284a45f55bae81ed888dc256432b8 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 11 Jun 2023 07:49:11 -0400 Subject: Consolidated status bar scripts for dwmstatus --- .local/bin/bar | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 .local/bin/bar (limited to '.local/bin/bar') diff --git a/.local/bin/bar b/.local/bin/bar new file mode 100755 index 0000000..1648119 --- /dev/null +++ b/.local/bin/bar @@ -0,0 +1,53 @@ +#!/bin/sh + +black='#1d2021' +green='#b8bb26' +white='#ebdbb2' +grey='#a89984' +blue='#6f8faf' +red='#fb4934' +darkblue='#458588' +blue='#83a598' +darkred="#cc241d" +darkgreen="#98971a" +darkyellow="#d79921" +darkblue="#458588" +darkmagenta="#b16286" +darkcyan="#689d6a" +darkgrey="#928374" +yellow="#fabd2f" +magenta="#d3869b" +cyan="#8ec07c" +bground="#282828" + +cpu() { + cpu="$(mpstat 1 1 | awk '/Average/ { printf "%.2f ",100-$12 }')" + temp="$(sensors | awk '/Tctl/ { print $2 } ' | tr -d '+')" + + printf "^c$black^^b$cyan^ CPU" + printf "^c$black^^b$cyan^ $cpu%%" + printf "^c$black^^b$cyan^ $temp " + printf "^c$bground^^b$bground^" +} + +mem() { + printf "^c$blue^^b$bground^$(free -h | awk '/^Mem/ { print $3}' | sed s/i//g)" +} + + +volume() { + stats=$(amixer sget Master | grep "Front Left:" | cut -d ' ' -f 7,8 | tr -d '[]') + [ "${stats##* }" = "on" ] && echo -n "^c$green^^b$black^ ${stats%% *}" || echo -n "^c$yellow^^b$darkgrey^ ${stats%% *}" +} + +storage() { + printf "^c$darkyellow^^b$bground^ $(df -H | awk '/\/$/ { print $4 }')" +} + +clock() { + printf "^c$black^^b$blue^ $(date +'%r') ^c$black^^b$darkblue^ $(date +'%A %D')" +} + +while true; do + sleep 1 && xsetroot -name "$(cpu) $(mem) $(volume) $(storage) $(clock) " +done -- cgit v1.2.3