From a880134140f7ab8195c6651c2f64f614855c8dce Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 11:00:53 +0200 Subject: mail: open accounts and messages in qtmaildir from the drawer and notifications qtmaildir now takes --account, --thread and --message, and hands them to a running window over its socket, so the drawer and the notifications can open the exact thing they show instead of just launching the client. mail-open.sh is the one place that turns an account and a thread into selectors, shared by both callers. It looks up the thread's newest unread message at click time rather than when the row or notification was built: by then it may have been read, and an empty lookup falls back to the whole thread instead of a miss in qtmaildir's status bar. The notification never had a working click: dunstify is not installed, so mail-notify.sh always took its notify-send fallback, which carried no action. It now uses notify-send -A NAME=Text, one action per listed thread (keyed by thread id, which is hex and so never holds the "=" separator) plus the account as default. The round trip through notifyd was checked: notifyctl action makes notify-send print the picked name. On the page, the account header opens the account and a thread row its newest unread message. Rows use TapHandler and HoverHandler because a MouseArea cannot fill a Column. Launches are detached: a first launch is the client itself, and the old reused Process would have killed it on the next click. Opening anything now closes the drawer rather than going back. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/mail/Accounts.qml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'desktop/modules/mail/Accounts.qml') diff --git a/desktop/modules/mail/Accounts.qml b/desktop/modules/mail/Accounts.qml index c2bc9d8..4f8b114 100644 --- a/desktop/modules/mail/Accounts.qml +++ b/desktop/modules/mail/Accounts.qml @@ -35,7 +35,7 @@ Singleton { // it is singular and the rows always sum to the header. readonly property string scope: "tag:unread and tag:inbox" - // [{ key, label, color, count, threads: [{ authors, date, subject }] }] + // [{ key, label, color, count, threads: [{ thread, authors, date, subject }] }] // count is -1 until known, and stays -1 on failure: a zero there would // read as an empty inbox. property var accounts: [] @@ -170,6 +170,7 @@ Singleton { const rows = JSON.parse(parts[1]); if (Array.isArray(rows)) { acct.threads = rows.map(r => ({ + thread: String(r.thread ?? ""), authors: String(r.authors ?? ""), date: String(r.date_relative ?? ""), subject: String(r.subject ?? "(no subject)"), @@ -206,12 +207,16 @@ Singleton { Timer { id: debounce; interval: 300; onTriggered: root.refresh() } Timer { id: respawn; interval: 5000; onTriggered: watcher.running = true } - // Launching qtmaildir. It takes no arguments, so there is nothing to tell - // it about the account or thread clicked. - Process { id: openProc; command: [`${Quickshell.env("HOME")}/bin/qtmaildir`] } - + // Launching qtmaildir, detached: a running client takes the selectors + // over its socket and the launch exits, but a first launch is the client + // itself and must not belong to a Process that the next click restarts. function openClient() { - openProc.running = false; - openProc.running = true; + Quickshell.execDetached([`${Quickshell.env("HOME")}/bin/qtmaildir`]); + } + + // An account, or a thread's newest unread message in it. mail-open.sh is + // shared with the notifications, so both open mail the same way. + function open(key, thread) { + Quickshell.execDetached([`${Quickshell.shellDir}/modules/mail/mail-open.sh`, key, thread || ""]); } } -- cgit v1.2.3