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

1
bashrc
View file

@ -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"

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,10 +124,7 @@ class Bar:
@staticmethod
def forever():
try:
while True:
time.sleep(60)
except BaseException:
Bar.process.wait()
Bar.stop()
def __init__(self, screen):

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

View file

@ -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

View file

@ -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:

View file

@ -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'])

20
scripts/syncthingRestore Executable file
View file

@ -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)

6
vimrc
View file

@ -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 """