-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more fixes (thanks @sevz17!), new bad modules system, inputregion fix
accidentally amended and can't be bothered to unsquash
- Loading branch information
1 parent
57da6eb
commit b7a63c5
Showing
9 changed files
with
168 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
copy modules/ into /usr/local/lib/dsystao | ||
|
||
OR just cd here and run `MODULES=modules ./dsystao` | ||
|
||
this is a huge hodgepodge of terribly applied sh knowledge | ||
counselling/contributions greatly appreciated | ||
|
||
what am I doing with my life | ||
|
||
have fun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
trap "kill -- -$$" INT EXIT | ||
|
||
CONFIG=${CONFIG:-~/.config/dsystao/dsystao.conf} | ||
if ! [ -f "$CONFIG" ]; then | ||
# make the default one | ||
echo '${clock} | ${interfaces} | ${audio} | ${battery}' > "$CONFIG" | ||
fi | ||
|
||
# TODO: find a better home for the module things | ||
MODULES=${MODULES:-/usr/local/lib/dsystao} | ||
[ -d "$MODULES" ] || echo "bad modules directory: '$MODULES'" >&2 | ||
|
||
( | ||
for m in $(sed -e 's/[^$]*${\([^}]*\)}[^$]*/\1 /g' $CONFIG); do | ||
$MODULES/$m | while IFS= read -r l; do echo "$m=$l"; done & #sed -e "s/^/$m=/" & | ||
done | ||
) | while IFS= read -r l; do | ||
export -- "$l" | ||
echo "$l" >&2 | ||
. "$CONFIG" | ||
done #| dtao -fn "monospace:pixelsize=16" -h 32 -z -z -fg "#f0f0e0" -bg "#101010" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo "${clock} | ${interfaces} | ${audio} | ${battery}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
refresh=${refresh:-10} | ||
|
||
loop() { | ||
set -f | ||
set -- $(amixer sget Master | tail -n 1 | awk 'BEGIN {FS="["; RS="]"; ORS=" "} {print $2}') | ||
set +f | ||
printf '^ca(1,amixer -q set Master ' | ||
if [ "$3" = "on" ]; then | ||
printf 'mute && %s)<(' "$_update" | ||
else | ||
printf 'unmute && %s)<X' "$_update" | ||
fi | ||
printf '%3s^ca()^ca(1,amixer -q set Master 5- && %s)-^ca()^ca(1,amixer -q set Master 5+ && %s)+^ca()\n' "${1%%\%}" "$_update" "$_update" | ||
} | ||
|
||
while true; do | ||
sleep "$refresh" & _update="kill -s USR1 $!" | ||
echo "$(loop)" | ||
wait | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
refresh="${refresh:-60}" | ||
|
||
while true; do | ||
batt="$(awk '{sum += $1; n++;} END{printf "%d", sum/n;}' /sys/class/power_supply/BAT*/capacity || echo '??')" | ||
if [ "$batt" -lt 100 ]; then | ||
case $(cat /sys/class/power_supply/BAT*/status) in | ||
Full) ;; | ||
Charging) | ||
batt="+${batt}";; | ||
Discharging) | ||
batt="-${batt}";; | ||
*) | ||
batt="?${batt}";; | ||
esac | ||
fi | ||
printf "%3s%%\n" "${batt}" | ||
sleep "$refresh" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
refresh="${refresh:-60}" | ||
|
||
while true; do | ||
printf "%16s\n" "$(date '+%H:%M %a %d %b')" | ||
sleep "$((60 - $(date +%S)))" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
refresh="${refresh:-4}" | ||
|
||
hr() { | ||
awk '{ | ||
s="bkMGTPEZY"; | ||
while ($1>=1000 && length(s)>1) | ||
{$1/=1024; s=substr(s,2)} | ||
print int($1+0.5) substr(s,1,1) | ||
}' | ||
} | ||
|
||
rxb=0 | ||
txb=0 | ||
t=0 | ||
|
||
while true; do | ||
_rxb=$rxb | ||
_txb=$txb | ||
rxb=$(($(paste -d+ /sys/class/net/*/statistics/rx_bytes))) | ||
txb=$(($(paste -d+ /sys/class/net/*/statistics/tx_bytes))) | ||
_t=$t | ||
t="$(cut -d' ' -f1 /proc/uptime)" | ||
_rxb="$(echo "($rxb-$_rxb)/($t-$_t)" | bc | hr)" | ||
_txb="$(echo "($txb-$_txb)/($t-$_t)" | bc | hr)" | ||
# shellcheck disable=3057 | ||
printf '%4s/%4s\n' "$_rxb" "$_txb" | ||
sleep "$refresh" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
while true; do | ||
sleep 1 & sleepid=$! | ||
echo "^ca(1,kill -s USR1 $sleepid)$sleepid^ca()" | ||
wait $sleepid | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters