35 lines
927 B
Python
35 lines
927 B
Python
|
#!/usr/bin/python
|
||
|
import subprocess
|
||
|
|
||
|
res = subprocess.check_output('', shell=True).decode('UTF-8')
|
||
|
running = subprocess.check_output(
|
||
|
'pueue status | rg Running | wc -l', shell=True).decode('UTF-8')
|
||
|
|
||
|
queued = subprocess.check_output(
|
||
|
'pueue status | rg Queued | wc -l', shell=True).decode('UTF-8')
|
||
|
|
||
|
failed = subprocess.check_output(
|
||
|
'pueue status | rg "(Failed|Killed)" | wc -l', shell=True).decode('UTF-8')
|
||
|
|
||
|
|
||
|
def printer(r, q, f):
|
||
|
bright = '#cccccc'
|
||
|
red = '#cc6666'
|
||
|
dim = '#777777'
|
||
|
|
||
|
def color(n):
|
||
|
return bright if n > 0 else dim
|
||
|
|
||
|
def color_red(n):
|
||
|
return red if n > 0 else dim
|
||
|
|
||
|
r, q, f = int(r), int(q), int(f)
|
||
|
line = ''
|
||
|
line += '%{F' + color(r) + '}' + str(r) + '%{F' + dim + '}/'
|
||
|
line += '%{F' + color(q) + '}' + str(q) + '%{F' + dim + '}/'
|
||
|
line += '%{F' + color_red(f) + '}' + str(f) + '%{F' + dim + '}'
|
||
|
print(line)
|
||
|
|
||
|
|
||
|
printer(running, queued, failed)
|