Archived
1
0

Initial commit

This commit is contained in:
2017-04-06 11:24:46 -05:00
commit f3583b3579
5 changed files with 311 additions and 0 deletions

2
py3status/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
__pycache__/
*.py[co]

22
py3status/color.py Normal file
View File

@@ -0,0 +1,22 @@
class Py3status:
force = False
class Meta:
container = True
def __init__(self):
self.items = []
def colorize(self):
output = []
for item in self.items:
out = self.py3.get_output(item)
if out and 'separator' not in out[-1]:
out[-1]['separator'] = True
for o in out:
if self.force or not o.get('color'):
o['color'] = self.color
output += out
return {'composite': output}

14
py3status/uptime.py Normal file
View File

@@ -0,0 +1,14 @@
import datetime
import math
class Py3status:
def uptime(self):
with open('/proc/uptime') as f:
secs = float(f.read().split()[0])
t = datetime.timedelta(seconds=math.floor(secs))
if t.days >= 1:
r = str(t).split(',')[0]
else:
r = str(t).rsplit(':', 1)[0]
return {'full_text': r, 'cached_until': self.py3.time_in(60)}