dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 19e0a15a762b68c5a8bc185c538b43eb787e5661
parent 6dca00914ea097d0db2a6b8269e5a9cfd9b37aa0
Author: hhvn <dev@hhvn.uk>
Date:   Fri,  3 Dec 2021 15:40:55 +0000

.s/d/{README,bat,cpu,mem,net,time,time2,vol}: redesign

Diffstat:
M.scripts/dwmblocks/README | 17++++++++---------
M.scripts/dwmblocks/bat | 13++++++++-----
M.scripts/dwmblocks/cpu | 2+-
M.scripts/dwmblocks/mem | 2+-
M.scripts/dwmblocks/net | 5+----
M.scripts/dwmblocks/time | 11++++++++++-
M.scripts/dwmblocks/time2 | 3++-
M.scripts/dwmblocks/vol | 11+++++++++--
8 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/.scripts/dwmblocks/README b/.scripts/dwmblocks/README @@ -1,10 +1,9 @@ - ____ -<|____| STAT [IP ADDR] [TORRENTS] [CPU usage% tempC] [MEM] [VOL vol% state] [DATE] [TIME] + +[BAT stat] [IP ADDR] [TORRENTS] [CPU usage% tempC] [MEM] [VOL vol%] [DAY DATE] [TIME] - ^ ^ ^ .---------------^ ^ .-----------^ ^ - | | red = no net | S = seeding/uploading | temps go from green | ditto cpu temps | green = unmuted | black = night - | | I = idle | to red as they rise | red = muted | dark blue = twilight - | ? = unknown | D = downloading | light blue = day (sunny) - | + = charging | Q = queued | white = day (cloudy) - | - = discharging - | # = full + ^ ^ ^ .---------------^ ^ .-------^ ^ ^-----------. ^ + | | red = no net | S = seeding/uploading | temps go from green | ditto cpu temps | normal = unmuted | green = weekend | white = winter | black = night + | | I = idle | to red as they rise | grey = muted | grey = weekday | yellow = spring | dark blue = twilight + | + = charging | D = downloading | green = summer | pink = day (sunny) + | - = discharching | Q = queued | red = autumn | white = day (cloudy) + | light blue = day (rainy) diff --git a/.scripts/dwmblocks/bat b/.scripts/dwmblocks/bat @@ -16,9 +16,12 @@ total=100 esac charge=$(apm | head -n 1 | sed -E 's/%.*//;s/.*([0-9])/\1/') } -num=$(echo "scale=2; ($charge/$total)*21" | bc | sed 's~\..*$~~') -ind="^c#aa6600^?" -[ "$charging" = "y" ] && ind="^c#00aa00^+" -[ $num -ge 19 ] && ind="^c#00aa00^#" +num=$(echo "scale=2; ($charge/$total)*100" | bc | sed 's~\..*$~~') +[ "$charging" = "y" ] && ind="^c#00aa00^+" +[ $num -ge 98 ] && ind="" [ "$discharging" = "y" ] && ind="^c#aa0000^-" -printf " ^c#555555^^r0,5,2,4^^r2,2,22,10^^d^^r3,3,20,8^^r$((23-$num)),3,$num,8^^d^^f24^$ind^d^ " + +[ "$discharging" != "y" ] && [ $num -ge 50 ] && col="^c#00aa00^" +[ "$discharging" = "y" ] && [ $num -lt 20 ] && col="^c#aa0000^" + +printf '[^c#7777cc^B%s%s%%%s]\n' "${col:-^c#aa7700^}" "$num" "$ind" diff --git a/.scripts/dwmblocks/cpu b/.scripts/dwmblocks/cpu @@ -9,4 +9,4 @@ temp=" $temp" [ $temp -gt 60 ] && temp="^c#aa0000^$temp" [ $temp -lt 55 ] && temp="^c#aaaa00^$temp" [ $temp -lt 50 ] && temp="^c#00aa00^$temp" -echo "[C $cpu%${temp}C]" +echo "[^c#7777cc^C^d^$cpu%${temp}C]" diff --git a/.scripts/dwmblocks/mem b/.scripts/dwmblocks/mem @@ -18,4 +18,4 @@ [ $used -gt 1500 ] && col="^c#aa7700^" [ $used -gt 2000 ] && col="^c#aa0000^" } -echo "[M ${col}${mem}]" +echo "[^c#7777cc^M^d^${col}${mem}]" diff --git a/.scripts/dwmblocks/net b/.scripts/dwmblocks/net @@ -1,12 +1,9 @@ #!/bin/sh # -# dwmblocks/net -# Created by Hayden Hamilton -# # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. -ip=$(curl -s http://icanhazip.com || echo "^c#aa0000^no net...") +ip=$(curl -s gopher://hlirc.net/0/ip.cgi || echo "^c#aa0000^no net...") [ -z $ip ] && exit ip=$(echo "$ip" | tail -n 1) echo "[$ip]" diff --git a/.scripts/dwmblocks/time b/.scripts/dwmblocks/time @@ -6,4 +6,13 @@ echo $(curl wttr.in/?format=%S) > $HOME/.cache/wttrS echo $(curl wttr.in/?format=%s) > $HOME/.cache/wttrs echo $(curl wttr.in/?format=%C) > $HOME/.cache/wttrC -echo "[$(date +%d/%m)]" +day=$(date +%A | tr '[:lower:]' '[:upper:]') +[ $(date +%u) -eq 6 ] || [ $(date +%u) -eq 7] && col="^c#007700^" || col="^c#888888^" + +month=$(date +%m) +[ $month -ge 3 ] && [ $month -le 5 ] && col2="^c#aaaa00^" #spring +[ $month -ge 6 ] && [ $month -le 7 ] && col2="^c#00aa00^" # summer +[ $month -ge 8 ] && [ $month -le 11 ] && col2="^c#a61028^" # autumn +[ $month -eq 12 ] || [ $month -eq 1 ] || [ $month -eq 2 ] && col2="^c#cccccc^" # winter + +printf "[%s%s%s%s]" "$col" "$day" "$col2" "$(date +%d/%m)" diff --git a/.scripts/dwmblocks/time2 b/.scripts/dwmblocks/time2 @@ -9,6 +9,7 @@ datediff $(cat $HOME/.cache/wttrd) $currdate | grep -v '^-' >/dev/null && col="^ datediff $(cat $HOME/.cache/wttrs) $currdate | grep -v '^-' >/dev/null && col="^c#000099^" } -cat $HOME/.cache/wttr | grep -i 'sunny' >/dev/null && col="^c#eeaaaa^" +<$HOME/.cache/wttrC grep -Ei 'clear|sun' >/dev/null && col="^c#eeaaaa^" +<$HOME/.cache/wttrC grep -Ei 'rain|shower' >/dev/null && col="^c#8888ee^" [ "$col" = "" ] && col="^c#cccccc^" echo "[${col}${currdate}]" diff --git a/.scripts/dwmblocks/vol b/.scripts/dwmblocks/vol @@ -9,5 +9,12 @@ toggled=$(sndioctl output.mute | sed 's/.*=//;s/0/on/;s/1/off/') volume=$(sndioctl output.level | sed -E 's/.*=//;s/(.)\.(..)(.)/\1\2.\3/;s/^0*//;s/\.0$//;s/$/%/') } -output="$(echo ${volume} | tr "\n" " ")$(echo "${toggled}" | grep 'on' >/dev/null && printf '^c#00cc00^' || printf '^c#cc0000^')$(echo ${toggled} | tr "\n" " " | sed 's/ //g')" -echo "[VOL $output]" + +colour="^c#7777cc^" +colour2="^d^" +echo "$toggled" | grep on >/dev/null || { + colour="^c#555555^" + colour2="^c#666666^" +} + +printf '[%sVOL%s%s]' "$colour" "$colour2" "${volume}"