mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-09 14:19:43 +00:00
Update the daypercentage module to fix bug and use python
This commit is contained in:
parent
a0cb7fddca
commit
79d7dacd4f
2 changed files with 11 additions and 13 deletions
|
@ -1,13 +0,0 @@
|
||||||
#!/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
|
|
11
modules/daypercentage.py
Executable file
11
modules/daypercentage.py
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
PREFIX = ' '
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
minutes = now.hour * 60 + now.minute
|
||||||
|
percentage = round(minutes * 100 / 1440)
|
||||||
|
|
||||||
|
print(PREFIX + str(percentage) + "%")
|
Loading…
Reference in a new issue