diff --git a/bashrc b/bashrc index e554993..7891bee 100644 --- a/bashrc +++ b/bashrc @@ -49,6 +49,7 @@ alias sl=ls alias al=la alias mdkir=mkdir alias systemclt=systemctl +alias please=sudo # Shortcuts for commonly used commands alias ll="ls -l $LS_OPTIONS" diff --git a/config/lemonbar/bar.py b/config/lemonbar/bar.py index b4585fc..75930ca 100755 --- a/config/lemonbar/bar.py +++ b/config/lemonbar/bar.py @@ -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) diff --git a/config/lemonbar/display.py b/config/lemonbar/display.py index 17de09e..1e1372f 100755 --- a/config/lemonbar/display.py +++ b/config/lemonbar/display.py @@ -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) diff --git a/config/lemonbar/providers.py b/config/lemonbar/providers.py index f572b28..b07f75e 100755 --- a/config/lemonbar/providers.py +++ b/config/lemonbar/providers.py @@ -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 diff --git a/config/todoman/todoman.conf b/config/todoman/todoman.conf index 74a4616..af6fea4 100644 --- a/config/todoman/todoman.conf +++ b/config/todoman/todoman.conf @@ -1,4 +1,4 @@ [main] -path = ~/.vdirsyncer/currentCalendars/* +path = ~/.vdirsyncer/calendars/* default_list = Personnel humanize = True diff --git a/scripts/install-prefs b/scripts/install-prefs index d5eadee..35405b7 100755 --- a/scripts/install-prefs +++ b/scripts/install-prefs @@ -261,7 +261,7 @@ if [ $EXTRA == 1 ]; then fi # Extra CLI - inst ffmpeg optipng syncthing mutt notmuch mbsync jq lynx + inst ffmpeg optipng syncthing mutt msmtp notmuch mbsync jq lynx inst unzip unrar jdupes bedup p7zip inst youtube-dl megatools speedtest-cli systemdUserUnit syncthing diff --git a/scripts/mel b/scripts/mel index 99cb44c..db9e102 100755 --- a/scripts/mel +++ b/scripts/mel @@ -251,6 +251,7 @@ def retag_msg(msg): slugFolder = tuple(slugFolderList) tags = set(msg.get_tags()) + def tag_if(tag, condition): if condition and tag not in tags: msg.add_tag(tag) @@ -267,7 +268,10 @@ def retag_msg(msg): # UID uid = msg.get_header("X-TUID") - assert isUID(uid) + if not isUID(uid): + # TODO Happens to sent mails but should it?k + print(f"{msg.get_filename()} has no UID!") + return uidtag = 'tuid{}'.format(uid) # Remove eventual others UID for tag in tags: diff --git a/scripts/melConf b/scripts/melConf index 9e45784..2c171a8 100755 --- a/scripts/melConf +++ b/scripts/melConf @@ -328,3 +328,9 @@ selectFilepath = os.path.join(os.path.expanduser('~'), '.mutt/muttrc') with open(selectFilepath, 'w') as f: f.write(selectStr) +## Color +for name, account in accounts.items(): + # Config + colorFilepath = os.path.join(os.path.expanduser('~'), f'{general["storage"]}/{name}/color') + with open(colorFilepath, 'w') as f: + f.write(account['color']) diff --git a/scripts/syncthingRestore b/scripts/syncthingRestore new file mode 100755 index 0000000..e1b3e5f --- /dev/null +++ b/scripts/syncthingRestore @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import os +import shutil + +curDir = os.path.realpath('.') +assert '.stversions/' in curDir +tgDir = curDir.replace('.stversions/', '') + + +for root, dirs, files in os.walk(curDir): + dstRoot = root.replace(curDir, tgDir) + os.makedirs(dstRoot, exist_ok=True) + for f in files: + srcPath = os.path.join(root, f) + dstF = f + dstPath = os.path.join(dstRoot, dstF) + print(f"{srcPath} → {dstPath}") + shutil.copy2(srcPath, dstPath) + diff --git a/vimrc b/vimrc index 8bd6940..1ff7033 100644 --- a/vimrc +++ b/vimrc @@ -58,14 +58,14 @@ Plug 'junegunn/fzf.vim' Plug 'ervandew/supertab' Plug 'dpelle/vim-LanguageTool' Plug 'terryma/vim-smooth-scroll' -Plug 'vim-pandoc/vim-pandoc' -Plug 'vim-pandoc/vim-pandoc-syntax' +" Plug 'vim-pandoc/vim-pandoc' +" Plug 'vim-pandoc/vim-pandoc-syntax' call plug#end() """ COMPLETOR """ -let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_at_startup = 0 """ UNDOTREE """