File transfer over dotfiles over git

This commit is contained in:
Geoffrey Frogeye 2018-10-18 21:14:11 +02:00
parent 45c3bfe4d4
commit b1b03e827f
10 changed files with 80 additions and 15 deletions

View file

@ -47,7 +47,8 @@ if __name__ == "__main__":
PERSONAL_THEME = 0
Bar.addSectionAll(KeystoreProvider(theme=PERSONAL_THEME), BarGroupType.RIGHT)
Bar.addSectionAll(NotmuchUnreadProvider(dir='~/.mail/', theme=PERSONAL_THEME), BarGroupType.RIGHT)
Bar.addSectionAll(TodoProvider(dir='~/.vdirsyncer/currentCalendars/', theme=PERSONAL_THEME), BarGroupType.RIGHT)
Bar.addSectionAll(TaskWarriorProvider(theme=PERSONAL_THEME), BarGroupType.RIGHT)
# Bar.addSectionAll(TodoProvider(dir='~/.vdirsyncer/currentCalendars/', theme=PERSONAL_THEME), BarGroupType.RIGHT)
TIME_THEME = 6
Bar.addSectionAll(TimeProvider(theme=TIME_THEME), BarGroupType.RIGHT)

View file

@ -24,7 +24,7 @@ log = logging.getLogger()
# TODO Use default colors of lemonbar sometimes
# TODO Adapt bar height with font height
# TODO OPTI Static text objects that update its parents if modified
# TODO OPTI Updater locks, do not LB screen util every updater finished
# TODO forceSize and changeText are different
class BarGroupType(enum.Enum):
@ -40,7 +40,7 @@ class BarStdoutThread(threading.Thread):
while Bar.running:
handle = Bar.process.stdout.readline().strip()
if not len(handle):
continue
Bar.stop()
if handle not in Bar.actionsH2F:
log.error("Unknown action: {}".format(handle))
continue
@ -124,11 +124,8 @@ class Bar:
@staticmethod
def forever():
try:
while True:
time.sleep(60)
except BaseException:
Bar.stop()
Bar.process.wait()
Bar.stop()
def __init__(self, screen):
assert isinstance(screen, int)

View file

@ -14,6 +14,8 @@ import json
import notmuch
import mpd
import random
import taskw
import math
coloredlogs.install(level='DEBUG', fmt='%(levelname)s %(message)s')
log = logging.getLogger()
@ -491,7 +493,6 @@ class NotmuchUnreadProvider(ColorCountsSection, InotifyUpdater):
if account == 'frogeye':
global q
q = query
print(489, self.dir, queryStr, nbMsgs)
if nbMsgs < 1:
continue
counts.append((nbMsgs, self.colors[account]))
@ -519,6 +520,41 @@ class NotmuchUnreadProvider(ColorCountsSection, InotifyUpdater):
self.addPath(os.path.join(self.dir, '.notmuch', 'xapian'))
class TaskWarriorProvider(StatefulSection, InotifyUpdater):
ICON = ''
NUMBER_STATES = 2
DEFAULT_STATE = 1
def __init__(self, theme=None):
InotifyUpdater.__init__(self)
StatefulSection.__init__(self, theme=theme)
self.taskw = taskw.TaskWarrior()
self.addPath(os.path.expanduser(self.taskw.config['data']['location']))
def fetcher(self):
maxi = -math.inf
total = 0
for task in self.taskw.load_tasks()['pending']:
urgency = task['urgency']
if urgency > maxi:
maxi = urgency
if urgency > 0:
total += urgency
t = Text()
maxi = round(maxi)
t.append(f"{maxi}")
if self.showTotal:
total = round(total)
t.append(f" | {total}")
return t
def onChangeState(self, state):
self.showTotal = state >= 1
class TodoProvider(ColorCountsSection, InotifyUpdater):
# TODO OPT/UX Maybe we could get more data from the todoman python module
# TODO OPT Specific callback for specific directory

View file

@ -1,4 +1,4 @@
[main]
path = ~/.vdirsyncer/currentCalendars/*
path = ~/.vdirsyncer/calendars/*
default_list = Personnel
humanize = True