Add real desktop notifications and systemd autostart for Gmail tray app - #6
shrutsureja wants to merge 15 commits into
Conversation
Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
…-875a-bbd6a93df320 Implement complete Gmail notifier with multi-account support, IMAP IDLE, and system tray integration
Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
…ld-time keys Co-authored-by: shrutsureja <92169549+shrutsureja@users.noreply.github.com>
…-b422-eaf61a2b11cd Add AES-256-GCM password encryption with persistent user-specific keys
The ai branch's systray app tracked unread counts but never actually popped up a notification for new mail. Track each account's last-seen IMAP UID in state.json so genuinely new messages (not existing unread mail on first run) trigger a notify-send popup with sender + subject. Also add a systemd --user unit for autostart on login, since the existing .desktop's X-GNOME-Autostart-enabled key had no effect sitting under /usr/share/applications (autostart requires the file to live under /etc/xdg/autostart or ~/.config/autostart).
How to test this locally on Ubuntu1. Install build dependenciessudo apt-get update
sudo apt-get install -y libayatana-appindicator3-dev libnotify-bin golang
2. Get a Gmail App Password (skip if you already have one)
3. Clone this branch and buildgit clone -b claude/ubuntu-email-notifications-bak0b8 https://github.com/shrutsureja/gmail-notifier.git
cd gmail-notifier
go build -o gmail-notifierThis produces a 4. Configure your account(s)Create {
"accounts": [
{
"email": "your-email@gmail.com",
"password": "your-16-char-app-password"
}
]
}Enter the App Password in plaintext here — it gets encrypted in place (AES-GCM, key at 5. Run it./gmail-notifier
Important on first run: existing unread mail in your inbox will NOT pop up a notification — that backlog is used to set the "last seen" baseline ( 6. Test the actual notificationWith the app running, send yourself a test email (from another account, or via
If no popup appears but the count updates, check that a notification daemon is running (built into GNOME/KDE; minimal WMs like i3/bspwm need something like 7. (Optional) Enable autostartmkdir -p ~/.local/bin && cp gmail-notifier ~/.local/bin/
mkdir -p ~/.config/systemd/user
sed "s|/usr/bin/gmail-notifier|$HOME/.local/bin/gmail-notifier|" gmail-notifier.service > ~/.config/systemd/user/gmail-notifier.service
systemctl --user daemon-reload
systemctl --user enable --now gmail-notifier.service
systemctl --user status gmail-notifier.service # confirm it's active
journalctl --user -u gmail-notifier.service -f # tail logsThings I couldn't verify myselfThis PR was built and Generated by Claude Code |
Summary
This branch was originally a minimal skeleton (
cmd/notifier+internal/...) that only had config loading and a one-shot IMAP connection test. Theaibranch had a much more complete implementation (multi-account IMAP IDLE monitoring, encrypted app-password storage, systray UI,.debpackaging), so this PR:aibranch's implementation as the new basenotify-send/similar for new mail. Each account's last-seen IMAP UID is now tracked instate.jsonso genuinely new messages (not the existing unread backlog on first run) trigger a popup showing sender + subject.systemd --userunit (gmail-notifier.service) for autostart on login. The existing.desktopfile'sX-GNOME-Autostart-enabled=truehad no effect since it lived under/usr/share/applicationsrather than/etc/xdg/autostartor~/.config/autostart.build.shandREADME.mdaccordingly (dependency onlibnotify-bin, autostart instructions for both.deband from-source installs).Changes
state.go: trackLastUIDper account, addGetLastUID/SetLastUIDimap.go: newRefresh()/checkNewMail()that detects newly-arrived UIDs viaUidFetch, fetches sender/subject, and calls back into the UI; replaces ad-hocGetUnreadCount()call sitesui.go: wires the new-mail callback tonotify-sendgmail-notifier.service: new systemd user unitbuild.sh: packages the systemd unit into the.deb, addslibnotify-bindependencyREADME.md: documents notifications behavior and autostart setupTest plan
go build ./...,go vet ./...,go test ./...all passgofmt -l .cleanGenerated by Claude Code