Last active
August 9, 2021 07:56
-
-
Save SharzyL/f0ad9dddc7774a986d1ceb921ee16eea to your computer and use it in GitHub Desktop.
30-hour clock is good, so display it on your i3bar
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
# A simple py3status module to display datetime on your i3bar as if there are 30 hours every day | |
# Usage: store this file as ~/.config/py3status/modules/trigesimal.py (or in directory storing | |
# py3status modules), then append `order += 'trigesimal'` to your py3status config file | |
# Timezone and locale setting is left to the user as a beneficial exercise. | |
import datetime | |
class Py3status: | |
def trigesimal(self): | |
d = datetime.datetime.now() | |
hour = d.hour | |
if hour < 6: | |
d -= datetime.timedelta(days=1) | |
hour += 24 | |
weekday = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][d.weekday()] | |
result = f'{d.year:04}-{d.month:02}-{d.day:02} {hour:02}:{d.minute:02}:{d.second:02} {weekday}' | |
return { | |
'full_text': result, | |
'cached_until': self.py3.time_in(sync_to=1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment