summary refs log tree commit diff
path: root/home/.local/bin/clock
blob: 704b40407d4e225ccb5935195063a32fa41b9eca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
set -eu

tput civis
sleep=$(( 60 - $(date +'%S' | sed 's/^0//') ))
while :; do
	if [ $(apm -a) -eq 1 ]; then
		printf '%3s%%' "$(apm -l)"
	else
		printf '%3.3sm' "$(apm -m)"
	fi
	printf ' %s\r' "$(date +'%a %H:%M')"
	sleep $sleep
	sleep=60
done