From abc19dcf714d2fe7efd537f9bdcb3609896d21ba Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Mon, 11 Sep 2023 08:05:16 +0400 Subject: [PATCH] dwmbar again --- config/dwmbar/bar.sh | 69 ++++++++++++++++++++++++++++++++++++ config/dwmbar/themes/sako.sh | 12 +++++++ 2 files changed, 81 insertions(+) create mode 100644 config/dwmbar/bar.sh create mode 100644 config/dwmbar/themes/sako.sh diff --git a/config/dwmbar/bar.sh b/config/dwmbar/bar.sh new file mode 100644 index 00000000..3d963409 --- /dev/null +++ b/config/dwmbar/bar.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# ^c$var^ = fg color +# ^b$var^ = bg color + +interval=0 + +# load colors +. ~/.dwmscripts/themes/sako.sh + +cpu() { + cpu_val=$(grep -o "^[^ ]*" /proc/loadavg) + + printf "^c$black^ ^b$red^ CPU" + printf "^c$white^ ^b$grey^ $cpu_val" +} + +battery() { + get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)" + get_status="$(cat /sys/class/power_supply/BAT1/status)" + case "$get_status" in + Charging) printf "^c$blue^ 󰂄 $get_capacity" ;; + Discharging) if (( $get_capacity <= 20)); then + printf "^c$lightred^ 󰂃 $get_capacity" + else + printf "^c$blue^ 󰁹 $get_capacity" + fi ;; + esac +} + +audio() { + get_vol=$(pamixer --get-volume-human) + if [ $get_vol = 'muted' ]; then + printf "^c$blue^ 󰕾 Muted" + else + printf "^c$blue^ 󰕾 $get_vol" + fi + #printf "^c$blue^ 󰕾 $get_vol" +} + +brightness() { + printf "^c$red^  " + printf "^c$red^%.0f\n" $(cat /sys/class/backlight/*/brightness) +} + +mem() { + printf "^c$blue^^b$black^  " + printf "^c$blue^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)" +} + +wlan() { + case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in + up) printf "^c$black^ ^b$blue^ 󰤨 ^d^%s" " ^c$blue^Connected" ;; + down) printf "^c$black^ ^b$blue^ 󰤭 ^d^%s" " ^c$blue^Disconnected" ;; + esac +} + +clock() { + printf "^c$black^ ^b$darkblue^ 󱑆 " + printf "^c$black^^b$blue^ $(date '+%H:%M') " +} + +while true; do + + [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] + interval=$((interval + 1)) + + sleep 1 && xsetroot -name "$(audio) $(battery) $(brightness) $(cpu) $(mem) $(clock)" +done diff --git a/config/dwmbar/themes/sako.sh b/config/dwmbar/themes/sako.sh new file mode 100644 index 00000000..9b1a5b7b --- /dev/null +++ b/config/dwmbar/themes/sako.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# colors + +black=#060606 +green=#7eca9c +white=#DBDBDB +grey=#9C8B8C +blue=#7aa2f7 +red=#4D1111 +lightred=#BD2D2D +darkblue=#668ee3