Use ROFI to search mail

This commit is contained in:
Thomas Dehaeze 2022-05-09 10:03:40 +02:00
parent ca5253116d
commit 18af7b3f3e

View File

@ -734,8 +734,10 @@ macro attach,compose,index,pager \cw "\
*** Searching using Mu
#+begin_src conf
macro index,pager \Cf "<shell-escape>mu find --clearlinks --format=links --linksdir=~/.mail/search " \
"mu find"
macro index,pager \Cf "<shell-escape>$HOME/.config/neomutt/bin/search_mail.sh<enter><change-folder-readonly>~/.mail/search<enter>" \
"test"
# macro index,pager \Cf "<shell-escape>mu find --clearlinks --format=links --linksdir=~/.mail/search " \
# "mu find"
macro index,pager gf "<change-folder-readonly>~/.mail/search<enter>" \
"mu find results"
#+end_src
@ -931,7 +933,10 @@ macro index,pager D \
**** Signature
#+begin_src conf :tangle ~/.config/neomutt/accounts/esrf.signature :comments none :padline no
Thomas Dehaeze
Thomas DEHAEZE
Mechatronics Engineer
ESRF - The European Synchrotron
Tel: +33 (0)4.76.88.22.34
#+end_src
This empty code block is used to add a new line after signature
#+begin_src conf :tangle ~/.config/neomutt/accounts/esrf.signature :comments none :padline no
@ -1129,14 +1134,35 @@ set abort_noattach_regex = "\\<(attach(|ed|ments?)|(attaché|attachés|attache|a
#+end_src
** Scripts and other config files
*** Send Mail Script
:PROPERTIES:
:header-args: :tangle ~/.config/neomutt/bin/send_mail.sh
:header-args+: :comments both :mkdirp yes
:header-args: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
*** Search Mail
#+begin_src bash :tangle ~/.config/neomutt/bin/search_mail.sh
arg_subject=$(rofi -p "Search" -dmenu)
arg_from=$(rofi -p "From" -dmenu)
if [ ! -z "$arg_from" ]; then
arg_from="from:${arg_from}"
fi
arg_to=$(rofi -p "To" -dmenu)
if [ ! -z "$arg_to" ]; then
arg_to="to:${arg_to}"
fi
arg_mime=$(echo -e "\napplication/pdf\nimage/*\nvideo/*" | rofi -i -p "Mime" -dmenu)
if [ ! -z "$arg_mime" ]; then
arg_mime="mime:${arg_mime}"
fi
mu find --clearlinks --format=links --linksdir=~/.mail/search "${arg_from} ${arg_to} ${arg_mime} ${arg_subject}"
#+end_src
*** Send Mail Script
#+begin_src bash :tangle ~/.config/neomutt/bin/send_mail.sh
msmtp -a $1 ${@:2} && \
if [ $TMUX ]; then
tmux split -v -l 1 mbsync $1-Sent && tmux select-pane -U
@ -1146,13 +1172,7 @@ msmtp -a $1 ${@:2} && \
#+end_src
*** Sync Mail Script
:PROPERTIES:
:header-args: :tangle ~/.config/neomutt/bin/get_new_mail.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
#+begin_src bash :tangle ~/.config/neomutt/bin/get_new_mail.sh
if [ $TMUX ]; then
tmux split -v -l 1 checkmail $1 && tmux select-pane -U
else
@ -1161,13 +1181,7 @@ fi
#+end_src
*** Openfile Scripts
:PROPERTIES:
:header-args: :tangle ~/.config/neomutt/bin/openfile.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
#+begin_src bash :tangle ~/.config/neomutt/bin/openfile.sh
base=$(basename "$1")
ext="${base##*.}"