dwmbar/modules/daypercentage
Your Name 747bddd93a Fixed bug with the daypercentage module
Bug occured when the hour was single digit, so we now remove preceding
0s
2021-11-02 09:57:31 +00:00

13 lines
303 B
Bash
Executable file

#!/bin/bash
# Prints the percentage of the day that has been completed
PREFIX=' '
get_daypercentage()
{
MINUTES="$[$(date +%R | cut -d ':' -f1 | sed 's/^0*//') * 60 + $(date +%R | cut -d ':' -f2) ]"
echo "$PREFIX$(echo $[ $MINUTES * 100 / 1440 ] | sed 's/\..*//g')%"
}
get_daypercentage