dotfiles

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

commit 4a9d32f942e942fed0fbe92a9c50c0a39c5593f5
parent 90cc9eb3f49915e9307b7f46be8b76e872ed7890
Author: hhvn <hayden@haydenvh.com>
Date:   Sun, 14 Feb 2021 07:03:13 +0000

.scripts/dwmblocks/*: more colour indicators

Diffstat:
A.scripts/dwmblocks/README | 9+++++++++
M.scripts/dwmblocks/bat | 10+++++-----
M.scripts/dwmblocks/cpu | 7++++---
D.scripts/dwmblocks/disk | 4----
D.scripts/dwmblocks/disk2 | 4----
M.scripts/dwmblocks/dwmbar | 6++----
M.scripts/dwmblocks/mem | 7++++++-
M.scripts/dwmblocks/net | 2+-
M.scripts/dwmblocks/time | 6++++++
M.scripts/dwmblocks/time2 | 13++++++++++++-
M.scripts/dwmblocks/vol | 2+-
11 files changed, 46 insertions(+), 24 deletions(-)

diff --git a/.scripts/dwmblocks/README b/.scripts/dwmblocks/README @@ -0,0 +1,9 @@ + ____ +<|____| STAT [IP ADDR] [TORRENTS] [CPU usage% tempC] [MEM] [VOL vol% state] [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 diff --git a/.scripts/dwmblocks/bat b/.scripts/dwmblocks/bat @@ -11,8 +11,8 @@ do grep -i 'discharg' < $b/status >/dev/null && discharging='y' done num=$(echo "scale=2; ($charge/$total)*21" | bc | sed 's~\..*$~~') -colour="#aa6600" -[ "$charging" = "y" ] && colour="#00aa00" -[ $num -ge 19 ] && colour="#00aa00" -[ "$discharging" = "y" ] && colour="#aa0000" -echo " ^r0,5,2,4^^r2,2,22,10^^c#000000^^r3,3,20,8^^c$colour^^r$((23-$num)),3,$num,8^^d^^f24^ " +ind="^c#aa6600^?" +[ "$charging" = "y" ] && ind="^c#00aa00^+" +[ $num -ge 19 ] && ind="^c#00aa00^+" +[ "$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^ " diff --git a/.scripts/dwmblocks/cpu b/.scripts/dwmblocks/cpu @@ -5,7 +5,8 @@ tempt=$(acpi -t | awk '{s+=$4} END {print s}') tempc=$(acpi -t | wc -l) temp=$(($tempt/$tempc)) temp=" $temp" -[ $temp -gt 60 ] && [ ! $temp -gt 70 ] && temp=" ^c#ffff00^^b#888800^$temp" -[ $temp -gt 70 ] && temp=" ^c#ff0000^^b#770000^$temp" -[ $temp -lt 40 ] && temp=" ^c#7777dd^^b#222277^$temp" +[ $temp -gt 60 ] && [ ! $temp -gt 70 ] && temp="^c#aa7700^$temp" +[ $temp -gt 70 ] && temp="^c#aa0000^$temp" +[ $temp -lt 60 ] && temp="^c#aaaa00^$temp" +[ $temp -lt 50 ] && temp="^c#00aa00^$temp" echo "[C $cpu%${temp}C]" diff --git a/.scripts/dwmblocks/disk b/.scripts/dwmblocks/disk @@ -1,4 +0,0 @@ -#!/bin/sh - -sda1=$(df -h | awk '/sda1/ {print $3 "/" $2}') -echo "[SDA1 $sda1]" diff --git a/.scripts/dwmblocks/disk2 b/.scripts/dwmblocks/disk2 @@ -1,4 +0,0 @@ -#!/bin/sh - -sda2=$(df -h | awk '/sda2/ {print $3 "/" $2}') -echo "[SDA2 $sda2]" diff --git a/.scripts/dwmblocks/dwmbar b/.scripts/dwmblocks/dwmbar @@ -19,7 +19,6 @@ done & while true do - block time block time2 sleep 1 done & @@ -27,8 +26,6 @@ done & while true do block news - block disk - block disk2 block mail block rem block torrent @@ -37,6 +34,7 @@ done & while true do + block time block net sleep 900 done & @@ -50,5 +48,5 @@ do do grep '[[:alnum:]]' < $f >/dev/null && cp $f /tmp/dwmblocks done - xsetroot -name " $(cat bat net torrent cpu mem disk disk2 vol time time2 2>/dev/null | sed '1~2s/^/\^c#ffaaaa\^/;2~2s/^/\^c#aaaaff\^/;s~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ')" + xsetroot -name " $(cat bat net torrent cpu mem vol time time2 2>/dev/null | sed 's~\[~ ^b#1a3136^ ~g;s~\]~ ^d^~g' | tr '\n' ' ')" done diff --git a/.scripts/dwmblocks/mem b/.scripts/dwmblocks/mem @@ -6,4 +6,9 @@ # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. -echo "[M $(free -h | awk '{print $3 "/" $2}' | head -n 2 | tail -n 1)]" +mem=$(free -h | awk '{print $3 "/" $2}' | head -n 2 | tail -n 1) +echo "$mem" | grep 'Mi/' >/dev/null && col="^c#00aa00^" +echo "$mem" | grep '1\.[0-4]Gi/' >/dev/null && col="^c#aaaa00^" +echo "$mem" | grep '1\.[5-9]Gi/' >/dev/null && col="^c#aa7700^" +echo "$mem" | grep '2\..Gi/' >/dev/null && col="^c#aa0000^" +echo "[M ${col}${mem}]" diff --git a/.scripts/dwmblocks/net b/.scripts/dwmblocks/net @@ -6,7 +6,7 @@ # haydenvh.com # Copyright (c) 2019 Hayden Hamilton. -ip=$(curl -s http://icanhazip.com) +ip=$(curl -s http://icanhazip.com || 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 @@ -1,3 +1,9 @@ #!/bin/sh +echo $(curl wttr.in/?format=%D) > $HOME/.cache/wttrD +echo $(curl wttr.in/?format=%d) > $HOME/.cache/wttrd +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)]" diff --git a/.scripts/dwmblocks/time2 b/.scripts/dwmblocks/time2 @@ -1,3 +1,14 @@ #!/bin/sh -echo "[$(date | awk '{print $4}')]" +currdate=$(date +%H:%M:%S) +datediff $(cat $HOME/.cache/wttrD) $currdate | grep '^-' >/dev/null && col="^c#000000^" +datediff $(cat $HOME/.cache/wttrd) $currdate | grep -v '^-' >/dev/null && col="^c#000000^" + +[ "$col" = "" ] && { + datediff $(cat $HOME/.cache/wttrS) $currdate | grep '^-' >/dev/null && col="^c#000099^" + 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^" +[ "$col" = "" ] && col="^c#cccccc^" +echo "[${col}${currdate}]" diff --git a/.scripts/dwmblocks/vol b/.scripts/dwmblocks/vol @@ -8,5 +8,5 @@ toggled=$(amixer sget Master | awk '/Mono/ {print $6}' | tr -d '[]') volume=$(amixer sget Master | awk '/Mono/ {print $4}' | tr -d '[]') -output=$(echo $(echo ${volume}|tr "\n" " ")$(echo ${toggled} | tr "\n" " " | sed 's/ //g')) +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]"