office: Rename mail module to office module
Reflecting the somewhat expanding scope of the module, renamed it to office. Still keeps the old files and setups but also got a new README file.
This commit is contained in:
parent
593628b81d
commit
03684ce29f
27 changed files with 28 additions and 15 deletions
27
office/.config/sh/alias.d/calcurse-vdir.sh
Normal file
27
office/.config/sh/alias.d/calcurse-vdir.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# Wraps around the calcurse invocation and syncs calendar data
|
||||
# to local vdir - given by default below.
|
||||
#
|
||||
# For now ONLY PROVIDES ONE-WAY Synchronization, see below.
|
||||
|
||||
# The path in which *the calendars* reside (i.e. toplevel with access to all paths)
|
||||
CAL_PATH="$HOME/documents/calendars"
|
||||
|
||||
calcurse() {
|
||||
find "$CAL_PATH" -maxdepth 1 -type d -exec calcurse-vdir import {} \;
|
||||
}
|
||||
|
||||
# Enable two-way sync. One issue is that calcurse would sync everything
|
||||
# into the top-level path (or the selected calendar path) since it makes
|
||||
# not the same differentiation as the vdir between calendars.
|
||||
# FIXME Not sure how to resolve currently.
|
||||
#
|
||||
# The below works as a simple two-way synchronization on exiting calcurse.
|
||||
# To function the invocation has to be turned from a function above to an
|
||||
# executable shell-script file instead.
|
||||
# trap 'calcurse_export' 0
|
||||
#
|
||||
# calcurse_export() {
|
||||
# calcurse-vdir export "$CAL_PATH"
|
||||
# }
|
||||
79
office/.config/sh/alias.d/fzfmail.sh
Normal file
79
office/.config/sh/alias.d/fzfmail.sh
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#!/usr/bin/env sh
|
||||
# Fzf searching notmuch email database
|
||||
|
||||
# Search with notmuch queries
|
||||
# You can either invoke:
|
||||
# `fzfmail` -> and then interactively create a notmuch query (not fuzzy searching)
|
||||
# or:
|
||||
# `fzfmail [notmuchquery]` -> pre-craft a query and then use fzf to filter it further, e.g.
|
||||
# fzfmail tag:archived and subject:Important and not tag:flagged
|
||||
#
|
||||
# select as many mails as you wish (ctrl-a for all current results)
|
||||
# preview mails with ?
|
||||
#
|
||||
# read with <enter>
|
||||
# re-tag with <ctrl-t>
|
||||
|
||||
if exist fzf; then
|
||||
# Allow fuzzy search filtering of a notmuch search query
|
||||
fzfmail() {
|
||||
# shellcheck disable=2016 # we only want the expression to expand when fzf preview is actually called not by the shell
|
||||
if [ -z "$1" ]; then
|
||||
# interactive query
|
||||
fzfmail_mails=$(
|
||||
printf "
|
||||
\nStart a notmuch search query:\n" |
|
||||
fzf --multi \
|
||||
--header "tag: | from: | to: | subject: | folder: | date: || and | not | or | near | adj || <enter> read | <ctrl-t> tag" \
|
||||
--bind "change:reload:notmuch search {q} || true" \
|
||||
--bind "ctrl-a:toggle-all" \
|
||||
--bind '?:toggle-preview' \
|
||||
--expect 'ctrl-t,esc' \
|
||||
--preview='notmuch show --part=1 $(echo {} | cut -d" " -f1)' \
|
||||
--preview-window hidden \
|
||||
--phony |
|
||||
cut -d" " -f1
|
||||
)
|
||||
else
|
||||
# pre-queried fuzzy search
|
||||
fzfmail_mails=$(
|
||||
notmuch search "$*" |
|
||||
fzf --multi \
|
||||
--header "<enter> read | <ctrl-t> tag" \
|
||||
--bind "ctrl-a:toggle-all" \
|
||||
--bind '?:toggle-preview' \
|
||||
--expect 'ctrl-t,esc' \
|
||||
--preview='notmuch show --part=1 $(echo {} | cut -d" " -f1)' \
|
||||
--preview-window hidden |
|
||||
cut -d" " -f1
|
||||
)
|
||||
fi
|
||||
|
||||
# find out expected action
|
||||
fzfmail_action=$(echo "$fzfmail_mails" | head -n1)
|
||||
# quit on esc pressed -- do not do anything with selected results
|
||||
if echo "$fzfmail_action" | grep -qe 'esc'; then return 0; fi
|
||||
|
||||
# get the selected mails
|
||||
fzfmail_mails=$(echo "$fzfmail_mails" | tail -n+2)
|
||||
|
||||
# tag mails
|
||||
if echo "$fzfmail_action" | grep -qe 'ctrl-t'; then
|
||||
printf "current tags: %s\n" "$(notmuch search --output=tags "$fzfmail_mails" | tr '\n' ' ')"
|
||||
printf "add tags with +tag; remove with -tag\n"
|
||||
printf "apply tags: "
|
||||
read -r fzfmail_tags
|
||||
notmuch tag "$fzfmail_tags" -- "$fzfmail_mails"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# display the mails, in semi-readable format
|
||||
# highlight subject line in color
|
||||
# allow moving through results with n/p
|
||||
notmuch show "$fzfmail_mails" | sed -e 's/^\fmessage{.*$/MESSAGE:/' -e '/^\f[a-z]/d' -e 's/^Subject:/\o033[41mSubject:\o033[0m/' | less --pattern '^MESSAGE:$' -R
|
||||
|
||||
unset fzfmail_mails
|
||||
unset fzfmail_action
|
||||
unset fzfmail_tags
|
||||
}
|
||||
fi
|
||||
3
office/.config/sh/alias.d/imapfilter-xdg.sh
Normal file
3
office/.config/sh/alias.d/imapfilter-xdg.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
alias imapfilter='imapfilter -c "${XDG_CONFIG_HOME:-$HOME/.config}/imapfilter/config.lua"'
|
||||
3
office/.config/sh/alias.d/mbsync-xdg.sh
Normal file
3
office/.config/sh/alias.d/mbsync-xdg.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
alias mbsync='mbsync -c ${XDG_CONFIG_HOME:-$HOME/.config}/isync/mbsyncrc'
|
||||
4
office/.config/sh/env.d/neomutt-create-cache-dir.sh
Normal file
4
office/.config/sh/env.d/neomutt-create-cache-dir.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
# Ensure the neomutt cache directories exist
|
||||
|
||||
[ -d "${XDG_CACHE_HOME:-~/.cache}/neomutt" ] || mkdir -p "${XDG_CACHE_HOME:-~/.cache}/neomutt/hcache"
|
||||
4
office/.config/sh/env.d/notmuch-xdg.sh
Normal file
4
office/.config/sh/env.d/notmuch-xdg.sh
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
# Make notmuch config comply with xdg base dir specification
|
||||
|
||||
export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-~/.config}/notmuch/config"
|
||||
Loading…
Add table
Add a link
Reference in a new issue