aboutsummaryrefslogtreecommitdiff
path: root/dwm/.dwm/bar
diff options
context:
space:
mode:
authorLuca Matei Pintilie <lucafulger@gmail.com>2021-12-21 20:22:43 +0000
committerLuca Matei Pintilie <lucafulger@gmail.com>2021-12-21 20:22:43 +0000
commit2169a4155362a7f1639e4ad78033abb193f2d565 (patch)
tree463b62f77e90862496fcab792a45c5d21f4d73fc /dwm/.dwm/bar
downloaddotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.tar
dotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.tar.gz
dotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.tar.bz2
dotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.tar.lz
dotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.tar.xz
dotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.tar.zst
dotfiles-2169a4155362a7f1639e4ad78033abb193f2d565.zip
Initial commit
Diffstat (limited to 'dwm/.dwm/bar')
-rwxr-xr-xdwm/.dwm/bar/bar.sh98
-rwxr-xr-xdwm/.dwm/bar/themes/dracula11
-rwxr-xr-xdwm/.dwm/bar/themes/gruvchad11
-rwxr-xr-xdwm/.dwm/bar/themes/nord11
-rwxr-xr-xdwm/.dwm/bar/themes/onedark11
5 files changed, 142 insertions, 0 deletions
diff --git a/dwm/.dwm/bar/bar.sh b/dwm/.dwm/bar/bar.sh
new file mode 100755
index 0000000..89cfdf4
--- /dev/null
+++ b/dwm/.dwm/bar/bar.sh
@@ -0,0 +1,98 @@
+#!/bin/dash
+
+# ^c$var^ = fg color
+# ^b$var^ = bg color
+
+interval=0
+
+# run bar script and dwm ( do not remove this )
+SYMLINKDIR=(readlink -f "$0")
+BASEDIR=$(dirname "$SYMLINKDIR")
+# load colors!
+. $BASEDIR/.dwm/bar/themes/onedark
+
+cpu() {
+ cpu_val=$(grep -o "^[^ ]*" /proc/loadavg)
+
+ printf "^c$black^ ^b$green^ CPU"
+ printf "^c$white^ ^b$grey^ $cpu_val"
+}
+
+pkg_updates() {
+ #updates=$(doas xbps-install -un | wc -l) # void
+ updates=$(checkupdates | wc -l) # arch , needs pacman contrib
+ # updates=$(aptitude search '~U' | wc -l) # apt (ubuntu,debian etc)
+
+ if [ -z "$updates" ]; then
+ printf "^c$green^ Fully Updated"
+ else
+ printf "^c$green^ $updates"" updates"
+ fi
+}
+
+battery() {
+ get_capacity="$(cat /sys/class/power_supply/BAT0/capacity)"
+ get_status="$(cat /sys/class/power_supply/BAT0/status)"
+ case $get_status in
+ Discharging)
+ printf "^c$blue^ 🔋 $get_capacity"
+ ;;
+ *)
+ printf "^c$blue^  $get_capacity"
+ ;;
+ esac
+}
+
+brightness() {
+ brightness="$(cat /sys/class/backlight/*/brightness)"
+ brightness_max="$(cat /sys/class/backlight/*/max_brightness)"
+ level=$(echo "scale=2; $brightness / $brightness_max * 100" | bc)
+
+ printf "^c$red^  "
+ printf "^c$red^%.0f\n" $level
+}
+
+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/w*/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 '+%I:%M %p') "
+}
+
+volume() {
+ volume_status="$(pamixer --get-volume-human)"
+ printf "^c$blue^ 🔊 $volume_status"
+}
+
+keyboard() {
+ keyboard_bits=$(xset -q | grep -A 0 'LED' | cut -c59-67)
+ case $keyboard_bits in
+ 00000000)
+ printf "^c$red^ ⌨️ en"
+ ;;
+ 00001000)
+ printf "^c$red^ ⌨️ no"
+ ;;
+ *)
+ printf "^c$red^ ⌨️ $keyboard_bits"
+ ;;
+ esac
+}
+
+while true; do
+
+ [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
+ interval=$((interval + 1))
+
+ sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(keyboard) $(wlan) $(volume) $(clock)"
+done
diff --git a/dwm/.dwm/bar/themes/dracula b/dwm/.dwm/bar/themes/dracula
new file mode 100755
index 0000000..086b154
--- /dev/null
+++ b/dwm/.dwm/bar/themes/dracula
@@ -0,0 +1,11 @@
+#!/bin/dash
+
+# colors
+
+black=#282a36
+green=#50fa7b
+white=#f8f8f2
+grey=#44475a
+blue=#bd93f9
+red=#ff5555
+darkblue=#6272a4
diff --git a/dwm/.dwm/bar/themes/gruvchad b/dwm/.dwm/bar/themes/gruvchad
new file mode 100755
index 0000000..4999d0e
--- /dev/null
+++ b/dwm/.dwm/bar/themes/gruvchad
@@ -0,0 +1,11 @@
+#!/bin/dash
+
+# colors
+
+black=#222526
+green=#89b482
+white=#c7b89d
+grey=#2b2e2f
+blue=#6f8faf
+red=#ec6b64
+darkblue=#6080a0
diff --git a/dwm/.dwm/bar/themes/nord b/dwm/.dwm/bar/themes/nord
new file mode 100755
index 0000000..d4a4415
--- /dev/null
+++ b/dwm/.dwm/bar/themes/nord
@@ -0,0 +1,11 @@
+#!/bin/dash
+
+# colors
+
+black=#2E3440
+green=#A3BE8C
+white=#D8DEE9
+grey=#373d49
+blue=#81A1C1
+red=#BF616A
+darkblue=#7292b2
diff --git a/dwm/.dwm/bar/themes/onedark b/dwm/.dwm/bar/themes/onedark
new file mode 100755
index 0000000..e2a42dd
--- /dev/null
+++ b/dwm/.dwm/bar/themes/onedark
@@ -0,0 +1,11 @@
+#!/bin/dash
+
+# colors
+
+black=#1e222a
+green=#7eca9c
+white=#abb2bf
+grey=#282c34
+blue=#7aa2f7
+red=#d47d85
+darkblue=#668ee3