summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2022-10-03 21:42:20 +0530
commitaf120ab348f2e1a5a39dec035ed9dcf84189a64e (patch)
tree2a3aadd7ce1b7b771dfe3fe7c983569726c8d7ed /scripts
downloaddotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.gz
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.tar.bz2
dotfiles-af120ab348f2e1a5a39dec035ed9dcf84189a64e.zip
dotfiles
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bar.sh63
-rw-r--r--scripts/bar_themes/catppuccin11
-rw-r--r--scripts/bar_themes/dracula11
-rwxr-xr-xscripts/bar_themes/everblush11
-rwxr-xr-xscripts/bar_themes/gruvchad11
-rwxr-xr-xscripts/bar_themes/nord11
-rwxr-xr-xscripts/bar_themes/onedark11
-rwxr-xr-xscripts/fetch77
-rwxr-xr-xscripts/run.sh10
9 files changed, 216 insertions, 0 deletions
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 _ </proc/uptime
+
+ # Convert the uptime from seconds into days, hours and minutes.
+ d=$((s / 60 / 60 / 24))
+ h=$((s / 60 / 60 % 24))
+ m=$((s / 60 % 60))
+
+ # Only append days, hours and minutes if they're non-zero.
+ case "$d" in [!0]*) uptime="${uptime}${d}d " ;; esac
+ case "$h" in [!0]*) uptime="${uptime}${h}h " ;; esac
+ case "$m" in [!0]*) uptime="${uptime}${m}m " ;; esac
+
+ echo ${uptime:-0m}
+}
+
+init() {
+ init=$(readlink /sbin/init)
+ init=${init##*/}
+ init=${init%%-*}
+ export init
+}
+init
+
+cat <<EOF
+${c0} ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
+${c0} ▎▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▎ ${c2} ${c0} ${c3} ${c0}${c1}  ${c0}▎ ${c1}${c4}${c1} ${c4}$user@${c1}$host
+${c0} ▎ ▎ ${c4}
+${c0} ▎ ${c4}█▀▀▀▀▀▀▀▀▀█${c0} ▎ ${c4}OS ${c7} $os
+${c0} ▎ ${c4}█ █${c0} ▎ ${c4}Kernel ${c7} $kernel
+${c0} ▎ ${c4}█ █ █ █${c0} ▎ ${c4}WM ${c7} $wm
+${c0} ▎ ${c0}█ █${c0} ▎ ${c4}Shell ${c7} $shell
+${c0} ▎ ${c0}▀█▄▄▄▄▄▄▄█▀${c0} ▎ ${c4}Init ${c7} $init
+${c0} ▎ ▎ ${c4}pkgs ${c7} $pkgs
+${c0} ▎ ▎ ${c4}uptime ${c7} $(get_uptime)
+${c0} ▎  ${c4}void  runit ^_^ ${c0} ▎ ${c4}memory ${c7} $mem $(echo / 3776MiB)
+${c0} ▎▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▎ $colors
+EOF
+
+if [[ $1 == "-b" ]]; then
+ for f in {0..6}; do
+ echo -en "\033[$((f + 41))m\033[$((f + 30))m██▓▒░"
+ done
+ echo -en "\033[37m██\n"
+ echo
+ for f in {0..6}; do
+ echo -en "\033[$((f + 41))m\033[1;$((f + 30))m██▓▒░"
+ done
+ echo -en "\033[1;37m██"
+ echo -e "\033[0m"
+ echo
+else
+ :
+fi
diff --git a/scripts/run.sh b/scripts/run.sh
new file mode 100755
index 0000000..2cbb3f2
--- /dev/null
+++ b/scripts/run.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+xrdb merge ~/.Xresources
+xbacklight -set 10 &
+feh --bg-fill ~/Pictures/wall/gruv.jpeg &
+xset r rate 200 50 &
+picom &
+
+~/.config/chadwm/scripts/./bar.sh &
+while type dwm >/dev/null; do dwm && continue || break; done