From af120ab348f2e1a5a39dec035ed9dcf84189a64e Mon Sep 17 00:00:00 2001 From: Biswakalyan Bhuyan Date: Mon, 3 Oct 2022 21:42:20 +0530 Subject: dotfiles --- scripts/bar.sh | 63 +++++++++++++++++++++++++++++++++++ scripts/bar_themes/catppuccin | 11 +++++++ scripts/bar_themes/dracula | 11 +++++++ scripts/bar_themes/everblush | 11 +++++++ scripts/bar_themes/gruvchad | 11 +++++++ scripts/bar_themes/nord | 11 +++++++ scripts/bar_themes/onedark | 11 +++++++ scripts/fetch | 77 +++++++++++++++++++++++++++++++++++++++++++ scripts/run.sh | 10 ++++++ 9 files changed, 216 insertions(+) create mode 100755 scripts/bar.sh create mode 100644 scripts/bar_themes/catppuccin create mode 100644 scripts/bar_themes/dracula create mode 100755 scripts/bar_themes/everblush create mode 100755 scripts/bar_themes/gruvchad create mode 100755 scripts/bar_themes/nord create mode 100755 scripts/bar_themes/onedark create mode 100755 scripts/fetch create mode 100755 scripts/run.sh (limited to 'scripts') diff --git a/scripts/bar.sh b/scripts/bar.sh new file mode 100755 index 0000000..4a90e4d --- /dev/null +++ b/scripts/bar.sh @@ -0,0 +1,63 @@ +#!/bin/dash + +# ^c$var^ = fg color +# ^b$var^ = bg color + +interval=0 + +# load colors +. ~/.config/chadwm/scripts/bar_themes/nord + +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/BAT1/capacity)" + printf "^c$blue^  $get_capacity" +} + +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 ] && updates=$(pkg_updates) + interval=$((interval + 1)) + + sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)" +done diff --git a/scripts/bar_themes/catppuccin b/scripts/bar_themes/catppuccin new file mode 100644 index 0000000..5f5b9fb --- /dev/null +++ b/scripts/bar_themes/catppuccin @@ -0,0 +1,11 @@ +#!/bin/dash + +# colors + +black=#1E1D2D +green=#ABE9B3 +white=#D9E0EE +grey=#282737 +blue=#96CDFB +red=#F28FAD +darkblue=#83bae8 diff --git a/scripts/bar_themes/dracula b/scripts/bar_themes/dracula new file mode 100644 index 0000000..ea2b4f4 --- /dev/null +++ b/scripts/bar_themes/dracula @@ -0,0 +1,11 @@ +#!/bin/dash + +# colors + +black=#21222c +green=#50fa7b +white=#f8f8f2 +grey=#282a36 +blue=#d6acff +red=#ff5555 +darkblue=#bd93f9 diff --git a/scripts/bar_themes/everblush b/scripts/bar_themes/everblush new file mode 100755 index 0000000..84e206b --- /dev/null +++ b/scripts/bar_themes/everblush @@ -0,0 +1,11 @@ +#!/bin/dash + +# colors + +black=#181f21 +green=#8ccf7e +white=#dadada +grey=#22292b +blue=#6da4cd +red=#ef7d7d +darkblue=#578eb7 diff --git a/scripts/bar_themes/gruvchad b/scripts/bar_themes/gruvchad new file mode 100755 index 0000000..4999d0e --- /dev/null +++ b/scripts/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/scripts/bar_themes/nord b/scripts/bar_themes/nord new file mode 100755 index 0000000..d4a4415 --- /dev/null +++ b/scripts/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/scripts/bar_themes/onedark b/scripts/bar_themes/onedark new file mode 100755 index 0000000..e2a42dd --- /dev/null +++ b/scripts/bar_themes/onedark @@ -0,0 +1,11 @@ +#!/bin/dash + +# colors + +black=#1e222a +green=#7eca9c +white=#abb2bf +grey=#282c34 +blue=#7aa2f7 +red=#d47d85 +darkblue=#668ee3 diff --git a/scripts/fetch b/scripts/fetch new file mode 100755 index 0000000..a0381e6 --- /dev/null +++ b/scripts/fetch @@ -0,0 +1,77 @@ +#!/bin/bash +clear +c=3 b=4 +for j in c b; do + for i in {0..7}; do + printf -v $j$i "%b" "\e[${!j}${i}m" + done +done + +user=$(whoami) +host=$(uname -a | awk '{print $2}') +memory=$(free -h) +os=$(source /etc/os-release && echo $PRETTY_NAME) +kernel=$(uname -sr) +wm="$(xprop -id $(xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}') -notype -f _NET_WM_NAME 8t | grep "WM_NAME" | cut -f2 -d \")" +mem=$(free -m | sed -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p') +pkgs="$(xbps-query -l | wc -l)" +shell=$(echo "$SHELL" | awk -F/ '{for ( i=1; i <= NF; i++) sub(".", substr(toupper($i),1,1) , $i); print $NF}') +colors=$(for i in {0..7}; do echo -en "\e[${1}$((30 + $i))m▁▁▁"; done) + +get_uptime() { + # Uptime works by retrieving the data in total seconds and then + # converting that data into days, hours and minutes using simple + # math. + IFS=. read -r s _ /dev/null; do dwm && continue || break; done -- cgit v1.2.3-59-g8ed1b