Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeSmithxyz authored Feb 28, 2025
2 parents 058fc42 + 05fcf7b commit 650794b
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 157 deletions.
30 changes: 9 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
.POSIX:

OS = $(shell uname -s)
ifndef PREFIX
PREFIX = /usr/local
endif
ifndef MANPREFIX
MANPREFIX = $(PREFIX)/share/man
endif
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man

install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/lib/mutt-wizard
cp -f bin/mw bin/mailsync $(DESTDIR)$(PREFIX)/bin/
cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard
chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/mutt-wizard
cp -f bin/mailsync $(DESTDIR)$(PREFIX)/bin
cp -f lib/openfile $(DESTDIR)$(PREFIX)/lib/mutt-wizard
chmod 755 $(DESTDIR)$(PREFIX)/share/mutt-wizard
for shared in share/*; do \
cp -f $$shared $(DESTDIR)$(PREFIX)/share/mutt-wizard; \
chmod 644 $(DESTDIR)$(PREFIX)/share/mutt-wizard/$$(basename $(notdir $$shared)); \
done
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
cp -f mw.1 $(DESTDIR)$(MANPREFIX)/man1/mw.1
cp -f mailsync.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1
sed 's:/usr/local:$(PREFIX):' < share/mutt-wizard.muttrc > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc
sed 's:/usr/local:$(PREFIX):' < share/mailcap > $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap
sed 's:/usr/local:$(PREFIX):' < bin/mw > $(DESTDIR)$(PREFIX)/bin/mw
sed 's:/usr/local:$(PREFIX):' < mw.1 > $(DESTDIR)$(MANPREFIX)/man1/mw.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/mw.1 $(DESTDIR)$(MANPREFIX)/man1/mailsync.1
if [ "$(PREFIX)" ]; then \
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrc; \
rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mutt-wizard.muttrcba; \
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/bin/mw; \
rm -f $(DESTDIR)$(PREFIX)/bin/mwba; \
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(MANPREFIX)/man1/mw.1; \
rm -f $(DESTDIR)$(MANPREFIX)/man1/mw.1ba; \
sed -iba 's:/usr/local:$(PREFIX):' $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcap; \
rm -f $(DESTDIR)$(PREFIX)/share/mutt-wizard/mailcapba; \
fi
chmod 755 $(DESTDIR)$(PREFIX)/bin/mw $(DESTDIR)$(PREFIX)/bin/mailsync $(DESTDIR)$(PREFIX)/lib/mutt-wizard/openfile
mkdir -p $(DESTDIR)$(PREFIX)/share/zsh/site-functions/
chmod 755 $(DESTDIR)$(PREFIX)/share/zsh/site-functions/
cp -f completion/_mutt-wizard.zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_mutt-wizard.zsh
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ https://muttwizard.com/

Get this great stuff without effort:

- A full-featured and autoconfigured email client on the terminal with neomutt
- A full-featured and autoconfigured email client on the terminal wibuiltth neomutt
- Mail stored offline enabling the ability to:
* view and write emails while you're away from
the internet
Expand Down Expand Up @@ -36,7 +36,7 @@ Specifically, this wizard:
- `msmtp` - sends the email.
- `pass` - safely encrypts passwords (required at install).
- `ca-certificates` - required for SSL. Probably installed already.
- `goimapnotify` - required for push notifications. [Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).
- `gettext` - writes config files. Probably installed already.

**Note**: There's a chance of errors if you use a slow-release distro like
Ubuntu, Debian, or Mint. If you get errors in `neomutt`, install the most
Expand All @@ -54,6 +54,8 @@ A user of Arch-based distros can also install the current mutt-wizard release fr

### Optional Dependencies

- `goimapnotify` - required for push notifications.
[Check here for reference](https://wiki.archlinux.org/title/Isync#With_imapnotify).
- `pam-gnupg` - Automatically logs you into your GPG key on login so you will
never need to input your password once logged on to your system. Check the
repo and directions out [here](https://github.com/cruegge/pam-gnupg).
Expand Down Expand Up @@ -215,6 +217,8 @@ systemctl enable --user [email protected]
applications requires turning off two-factor authentication and this will
circumvent that. You might also need to manually "Enable IMAP" in the
settings.
To create an App Password for your Google account,
you can directly visit the [App Passwords](https://myaccount.google.com/apppasswords) page in your Google Account settings.
- If you have a university email or enterprise-hosted email for work, there
might be other hurdles or two-factor authentication you have to jump through.
Some, for example, will want you to create a separate IMAP password, etc.
Expand Down
15 changes: 8 additions & 7 deletions bin/mailsync
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ case "$(uname)" in
notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do
export DISPLAY="$x"
notify-send --app-name="mutt-wizard" "$1" "$2"
notify-send --app-name="mutt-wizard" -- "$1" "$2"
done ;}
;;
esac
Expand All @@ -63,16 +63,17 @@ syncandnotify() {
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
case 1 in
$((newcount > 5)) )
echo "$newcount new mail for $2."
[ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account."
echo "$newcount new mails for $2." >/dev/tty
[ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mails in \`$2\` account."
;;
$((newcount > 0)) )
echo "$newcount new mail for $2."
echo "$newcount new mail(s) for $2." >/dev/tty
[ -z "$MAILSYNC_MUTE" ] &&
for file in $new; do
# Extract and decode subject and sender from mail.
subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
# Extract and decode subject and sender from mail.
subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' |
sed 's/^Subject: //' | tr -d '\n\t')
from="$(sed -n "/^From:/ s|From: *|| p" "$file" |
perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')"
from="${from% *}" ; from="${from%\"}" ; from="${from#\"}"
Expand Down
Loading

0 comments on commit 650794b

Please sign in to comment.