From d393a59dd34a1eb1c519cc722aab082fa2f36f11 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Wed, 12 Feb 2020 10:29:06 +0100 Subject: zsh: Disable rprompt, alias ls to exa --- dot.zshrc.local | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dot.zshrc.local b/dot.zshrc.local index a1a4456..ee8d456 100644 --- a/dot.zshrc.local +++ b/dot.zshrc.local @@ -1,4 +1,5 @@ # -*- shell-script -*- +zstyle :prompt:grml:right:setup use-rprompt false . ~/.zshrc.from_grml (( $+commands[bsdtar] )) && alias tar=bsdtar (( $+commands[chg] )) && alias hg=chg @@ -7,8 +8,12 @@ alias g=git alias ec="emacsclient -n" alias et="emacsclient -t" alias hl="highlight -O ansi" -zstyle :prompt:grml:left:items:percent pre ' -' +if (( $+commands[exa] )); then + alias ls="exa" + alias l="exa -l --git" + alias la="exa -la --git" +fi +zstyle :prompt:grml:left:items:percent pre $'\n' gpg-connect-agent /bye ssh-add -l function countdown { -- cgit v1.2.3 From 83d087656bb4d94195e9a7b71933205f34dd7812 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Thu, 27 Feb 2020 12:14:11 +0100 Subject: Emacs: Remove projectile --- dot.emacs.d/init.el | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/dot.emacs.d/init.el b/dot.emacs.d/init.el index 2f7f193..3bfa0da 100644 --- a/dot.emacs.d/init.el +++ b/dot.emacs.d/init.el @@ -54,11 +54,6 @@ :init (exec-path-from-shell-initialize)) (setenv "LANG" "de_DE.UTF-8")) -(use-package projectile - :config (projectile-mode 1) - :bind-keymap ("C-c p" . projectile-command-map) - :defer nil) - (use-package company :bind (:map company-mode-map ([remap completion-at-point] . #'company-complete)) @@ -147,11 +142,6 @@ helm-recentf-fuzzy-match t helm-ff-file-name-history-use-recentf t helm-echo-input-in-header-line t)) -(use-package helm-projectile - :config - (setq projectile-completion-system 'helm) - (helm-projectile-on) - :after (projectile helm)) (use-package helm-rg :after helm) -- cgit v1.2.3 From be92589235e76cf75575c97b43906a41ded934aa Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Thu, 27 Feb 2020 12:15:46 +0100 Subject: Emacs: Company stuff --- dot.emacs.d/init.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dot.emacs.d/init.el b/dot.emacs.d/init.el index 3bfa0da..9f370ce 100644 --- a/dot.emacs.d/init.el +++ b/dot.emacs.d/init.el @@ -58,12 +58,10 @@ :bind (:map company-mode-map ([remap completion-at-point] . #'company-complete)) :config - (global-company-mode) (setq company-tooltip-align-annotations t company-minimum-prefix-length 1)) (use-package company-math :config - (add-to-list 'company-backends 'company-math-symbols-unicode) (add-hook 'TeX-mode-hook (defun qsx-TeX-mode-hook-company () (setq-local company-backends (append '((company-math-symbols-latex company-latex-commands)) @@ -81,7 +79,6 @@ :config (add-to-list 'company-backends 'company-ansible)) (use-package company-shell :config (add-to-list 'company-backends '(company-shell company-shell-env))) -(use-package company-lsp) (semantic-mode 1) (use-package srefactor @@ -95,11 +92,13 @@ (advice-add 'python-mode :before 'elpy-enable)) (use-package lsp-mode - :commands lsp - :config (require 'lsp-clients)) + :commands lsp) (use-package lsp-ui) +(use-package company-lsp + :hook (company-mode . yas-minor-mode)) + (use-package mercurial :ensure nil :bind-keymap ("C-c H" . hg-global-map)) -- cgit v1.2.3 From 58240e77e204919e7ddd48b6b162dfe9fd66dd1e Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Thu, 27 Feb 2020 12:16:44 +0100 Subject: i3: Add Emacs local conf --- dot.config-i3-config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dot.config-i3-config b/dot.config-i3-config index aa76aa3..149a3c9 100644 --- a/dot.config-i3-config +++ b/dot.config-i3-config @@ -162,3 +162,7 @@ bindsym $mod+Shift+F1 exec setxkbmap de bindsym $mod+F2 exec setxkbmap de ru bindsym $mod+F3 exec setxkbmap gr bindsym $mod+F4 exec setxkbmap us + +# Local Variables: +# mode: conf +# End: -- cgit v1.2.3 From 462f6f28c548b0d738e44c6c577f90927724cf2a Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Thu, 27 Feb 2020 12:17:03 +0100 Subject: Update Polybar config --- dot.config-polybar-config | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dot.config-polybar-config b/dot.config-polybar-config index 5b40172..0135a3f 100644 --- a/dot.config-polybar-config +++ b/dot.config-polybar-config @@ -1,13 +1,16 @@ +# -*- conf -*- [colors] background = #222 background-alt = #444 foreground = #dfdfdf -foreground-alt = #555 +#foreground-alt = #555 +foreground-alt = #00ff00 primary = #ffb52a secondary = #e60053 alert = #bd2c40 [bar/top] +monitor = eDP-1 width = 100% height = 30 radius = 6.0 @@ -25,7 +28,7 @@ border-size = 4 border-color = #00000000 padding-left = 0 -padding-right = 2 +padding-right = 1 module-margin-left = 0 module-margin-right = 1 @@ -36,7 +39,7 @@ font-2 = "Noto Emoji:size=8;0" modules-left = i3 modules-center = mpd -modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth backlight-acpi battery temperature date +modules-right = pulseaudio xkeyboard memory cpu wlan eth backlight-acpi battery temperature date tray-position = right tray-padding = 0 @@ -177,11 +180,11 @@ format-disconnected = type = internal/date interval = 1 -date = -date-alt = " %Y-%m-%d" +date-alt = +date = " %Y-%m-%d" -time = %H:%M -time-alt = %H:%M:%S +time-alt = %H:%M +time = %H:%M:%S format-prefix =  format-prefix-foreground = ${colors.foreground-alt} -- cgit v1.2.3 From 54697444ad9f341f8e4b4e440c56a5f8af505e65 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Thu, 27 Feb 2020 12:17:41 +0100 Subject: zsh: Add rsync alias --- dot.zshrc.local | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dot.zshrc.local b/dot.zshrc.local index ee8d456..13d722f 100644 --- a/dot.zshrc.local +++ b/dot.zshrc.local @@ -13,6 +13,9 @@ if (( $+commands[exa] )); then alias l="exa -l --git" alias la="exa -la --git" fi +if (( $+commands[rsync] )); then + alias rs="rsync -vahPi" +fi zstyle :prompt:grml:left:items:percent pre $'\n' gpg-connect-agent /bye ssh-add -l -- cgit v1.2.3 From 76cb3c3dadb43125ac068be0a49bf70bf5628dc4 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Mon, 23 Mar 2020 20:37:09 +0100 Subject: Update .hgrc --- dot.hgrc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dot.hgrc b/dot.hgrc index 0f3c49f..6089a62 100644 --- a/dot.hgrc +++ b/dot.hgrc @@ -3,6 +3,7 @@ [ui] username = Thomas Schneider +tweakdefaults = true [email] method = sendmail @@ -11,20 +12,13 @@ method = sendmail gpg = histedit = mq = -pager = patchbomb = -progress = purge = rebase = -record = remotenames = strip = zeroconf = -[diff] -git = true -showfunc = true - [alias] describe = log -r . --template '{latesttag}-{latesttagdistance}-{node|short}\n' glog = log -G -- cgit v1.2.3 From d9b0575af92aebb084e481491e6f34fef474c4fe Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Tue, 7 Apr 2020 13:47:49 +0200 Subject: zsh: Disable chg It turned out to be slower. --- dot.zshrc.local | 1 - 1 file changed, 1 deletion(-) diff --git a/dot.zshrc.local b/dot.zshrc.local index 13d722f..7d6c93a 100644 --- a/dot.zshrc.local +++ b/dot.zshrc.local @@ -2,7 +2,6 @@ zstyle :prompt:grml:right:setup use-rprompt false . ~/.zshrc.from_grml (( $+commands[bsdtar] )) && alias tar=bsdtar -(( $+commands[chg] )) && alias hg=chg (( $+commands[nvim] )) && alias vim=nvim alias g=git alias ec="emacsclient -n" -- cgit v1.2.3 From ddadb27ed3e68c31b4b23fbc163d90db319d6fbf Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Tue, 7 Apr 2020 13:48:11 +0200 Subject: zsh: Show groups in l/la using exa --- dot.zshrc.local | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dot.zshrc.local b/dot.zshrc.local index 7d6c93a..8dd9652 100644 --- a/dot.zshrc.local +++ b/dot.zshrc.local @@ -9,8 +9,8 @@ alias et="emacsclient -t" alias hl="highlight -O ansi" if (( $+commands[exa] )); then alias ls="exa" - alias l="exa -l --git" - alias la="exa -la --git" + alias l="exa -g -l --git" + alias la="exa -g -la --git" fi if (( $+commands[rsync] )); then alias rs="rsync -vahPi" -- cgit v1.2.3 From 6661cd7bdbbe40ce325d0aaadabb9bb80aaef969 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Fri, 17 Apr 2020 13:27:25 +0200 Subject: Add nm-tagger and adapt sm --- dot.local-bin-nm--tagger | 140 +++++++++++++++++++++++++++++++++++++++++++++++ dot.local-bin-sm | 9 ++- 2 files changed, 146 insertions(+), 3 deletions(-) create mode 100755 dot.local-bin-nm--tagger diff --git a/dot.local-bin-nm--tagger b/dot.local-bin-nm--tagger new file mode 100755 index 0000000..f2de0d2 --- /dev/null +++ b/dot.local-bin-nm--tagger @@ -0,0 +1,140 @@ +#!/usr/bin/env python3.7 +"""Tagging script based on mail folder names for Notmuch + +This scripts iterates through all messages with ``tag:new``, and replaces that +by tags based on the name of the maildir folder(s) the message is in. By +default, it takes the first and last component to form the name. This suits my +personal pre-Notmuch mail setup, with hierarchical IMAP folders, where the tuple +(account, last_folder) is unique for almost all folders. + +My maildirs have the account name as first component and the IMAP part as the +rest. So, for example, ``.maildir/Chaotikum/INBOX/Notmuch`` gets the tags +``Chaotikum`` and ``Notmuch``. + +Additionally, folder names can be mapped to other tag names. This can come in +handy when you need to use Exchange and its default names, yet want to keep all +sent messages—whether they are in ``.maildir/Acc/Sent`` or in +``.maildir/Exchange/Sent Messages``—under ``tag:sent``. + +See :py:func:`read_config` for configuration details. + +""" + +import json +import logging as log +from pathlib import Path +import notmuch + +DEFAULT_CONFIG = { + "folder_separator": ".", + "keep": [], + "transforms": { + "Drafts": "draft", + "INBOX": "inbox", + "Junk": "spam", + "Sent": "sent", + }, +} +"""Default config, overridden with the user-provided one""" + + +def read_config(): + """Returns the user’s config, with ``DEFAULT_CONFIG`` as base. + + The config is read from ``$XDG_CONFIG_HOME/nm-tagger/config.json`` and shall + contain three keys: + + ``folder_separator`` + The character that separates logical folder names, or + the special value ``#FILESYSTEM#``. + + For example, ``.`` means that the Maildir directories are named like + ``.maildir/This.INBOX.is.deeply.nested``. + + The value ``#FILESYSTEM#`` means to use the file system directories (on + most systems, this has the same effect as ``/``). + + ``keep`` + A list of folder names that are assigned as tags, even if they are + neither at the begin nor end. + + ``transforms`` + A dictionary mapping folder names to tags. + + """ + try: + from xdg import BaseDirectory + + config_path_base = Path(BaseDirectory.load_first_config("nm-tagger")) + except ImportError: + from os import environ + + config_path_base = environ["XDG_CONFIG_HOME"] + if config_path_base != "": + config_path_base = Path(config_path_base) + else: + config_path_base = Path.home() / ".config" / "nm-tagger" + except KeyError: + config_path_base = Path.home() / ".config" / "nm-tagger" + + config_path = config_path_base / "config.json" + + try: + with open(config_path) as fp: + config = json.load(fp) + log.info("Loaded config from %s", config_path) + log.debug("Config: %s", config) + except FileNotFoundError: + log.warn("Config file %s not found!", config_path) + config = {} + return {**DEFAULT_CONFIG, **config} + + +def main(): + """Entry point""" + log.basicConfig(format="%(asctime)s %(levelname)s: %(message)s", level=log.DEBUG) + + config = read_config() + + with notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE) as db: + top = Path(db.get_path()) + log.info("Opened notmuch db at %s", top) + new_messages_query = notmuch.Query(db, "tag:new") + log.info("Found %d messages to process", new_messages_query.count_messages()) + new_messages = set(new_messages_query.search_messages()) + + db.begin_atomic() + + for m in new_messages: + mid = m.get_message_id() + _paths = {Path(p).relative_to(top) for p in m.get_filenames()} + if config["folder_separator"] == "#FILESYSTEM#": + paths = {p.parts[:-2] for p in _paths} + else: + paths = { + p.parent.parent.as_posix().split(config["folder_separator"]) + for p in _paths + } + log.debug("paths of %s: (%d) %s", mid, len(paths), str(paths)) + tags = set() + for _p in paths: + p = tuple(map(lambda c: config["transforms"].get(c, c), _p)) + tags.add(p[0]) + tags.add(p[-1]) + for c in p[1:-1]: + if c in config["keep"]: + tags.add(c) + log.debug("tags for %s: %s", mid, str(tags)) + try: + m.freeze() + for t in tags: + m.add_tag(t) + m.remove_tag("new") + finally: + m.thaw() + + db.end_atomic() + + +if __name__ == "__main__": + main() diff --git a/dot.local-bin-sm b/dot.local-bin-sm index cdea8e4..c519299 100755 --- a/dot.local-bin-sm +++ b/dot.local-bin-sm @@ -3,10 +3,13 @@ set -e set -x mbsync -a || true notmuch new +[ -d ~/.maildir/GMail ] && (cd ~/.maildir/GMail && gmi sync) new=$(notmuch search --output=messages tag:new | xargs) [ -z "$new" ] && exit -afew -tnvv +notmuch config set query.new "$new" +notmuch tag -new -- tag:new and folder:GMail/mail +nm-tagger export MAILSEQ="${MBLAZE:-$HOME/.mblaze}/seq.sm" export MBLAZE_PAGER="" -msearch -- --exclude=false $new | mthread | mseq -S | mscan -f '%u%r %3n %10d %17f %8F %t %i%S' -type mu 2> /dev/null && mu index || true +msearch -- --exclude=false query:new | mthread | mseq -S | mscan -f '%u%r %3n %10d %17f %8F %t %i%S' +type mu > /dev/null && mu index || true -- cgit v1.2.3 From 15435b0f800ba61d955f7ebe54c48a21777f2fb4 Mon Sep 17 00:00:00 2001 From: Thomas Schneider Date: Fri, 17 Apr 2020 13:30:25 +0200 Subject: Update xprofile --- dot.xprofile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dot.xprofile b/dot.xprofile index 7126d49..7cdd235 100644 --- a/dot.xprofile +++ b/dot.xprofile @@ -1,13 +1,12 @@ +# -*- shell-script -*- if [ "$XPROFILE_RUN" != "yes" ]; then export XPROFILE_RUN=yes + export TERMINAL=kitty-1 export GDK_SCALE=2 xrandr --dpi 192 - export TERMINAL=qterminal [ -f ~/.fehbg ] && ~/.fehbg - xss-lock -- physlock -p "Locked by: $USER" -s -m & - nm-applet & - redshift-gtk & - compton --backend=glx --glx-swap-method=buffer-age -b + xss-lock -- ~/.local/bin/i3lock-wrapper & + type nm-applet >/dev/null && nm-applet & (while ! pidof i3; do sleep 1; done; exec polybar -r top) & fi export XPROFILE_RUN=yes -- cgit v1.2.3