summaryrefslogtreecommitdiffstats
path: root/.local/bin/mailto_handler
blob: 36c38bdcd91fc8c34649a226629cc604d77e8648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

set -e # we can now exit out from rofi, easily

# rofi available mail accounts

ACCOUNTSDIR=$HOME/.config/mutt/accounts

choices=''
first='0'

for account in "${ACCOUNTSDIR}"/*.muttrc; do
    BASENAME=$(basename -- "${account}")
    pick="${BASENAME%.muttrc}"
    if [ $first -eq '0' ]; then
        choices="${pick}"
        first='1'
    else
        choices="${choices}\n${pick}"
    fi

done

picked=$(printf '%s' "${choices}" | rofi -dmenu)

exec kitty -e neomutt -F "$HOME/.config/mutt/muttrc" -e "source /home/yigit/.config/mutt/accounts/${picked}.muttrc" -- "$@"