Work/play balance in i3 statusbar

Every productivity thought I’ve ever had, as concisely as possible - Alexey Guzey has been extremely inspiring. I added “work/play” to my statusbar, just for fun, with the following code to the statusbar wrapper script:

bashCommand2 = "date +%R" #returns %H:%M in 24h-format
bashOutput2 = subprocess.check_output(['bash','-c', bashCommand2]).decode('utf-8').strip('\n')
time=bashOutput2.split(":")
hour=int(time[0])
minute=int(time[1])

if hour in {9, 12, 15, 18, 21}:
    if minute>5 and minute<35:
        wp="P"
    else:
        wp="W"
else:
    if minute<5 or (minute>30 and minute<35):
        wp="P"
    else:
        wp="W"

j.insert(0, {'full_text' : '%s' % wp, 'name' : 'wp'})

TODO – py3status

Stumbled upon Modules — py3status 3.20 documentation, and this looks like a much better alternative to the above. I’d need to move the python script in a separate file and that’s okay, everything else is absolutely wonderful.