Unread counts, a window margin, blurred dialogs, softer group names

Each rise in an app's unread count while you are elsewhere adds to a
tally beside its name, and a dot on its icon in the rail. Looking at the
app is the only thing that clears it.

The window has no frame of its own, so the shell now keeps a 6px margin
in a normal window - the only part of it that is not a web page, and so
the only place left to grab. Full screen gives the room back.

Dialogs get the app blurred behind them. An app's webview paints above
the shell, so it has to be moved aside before a dialog can be seen at
all, and once moved there is nothing left to blur - a still taken on the
way out is the only way to keep the background there. It runs on a
blocking worker: its completion handler is on the main thread, and
waiting there deadlocks until the timeout and returns nothing.

Settings is much larger, the cog moved to the foot of the nav, group
names read as names rather than shouted headings, and "Refresh icons"
bumps a version every favicon URL carries, for the ones that cache wrong.
This commit is contained in:
2026-09-01 14:31:51 +02:00
parent 8f989fb8f6
commit 1b6dabab0a
13 changed files with 369 additions and 33 deletions
+79
View File
@@ -170,6 +170,15 @@ fn handle_sentinel(
.map(|a| a.name.clone())
.unwrap_or_else(|| "Work".into());
let n: u32 = delta.parse().unwrap_or(1);
{
let state = handle.state::<crate::commands::AppState>();
let mut counts = state.unread.lock().unwrap();
*counts.entry(from.clone()).or_insert(0) += n;
}
let state = handle.state::<crate::commands::AppState>();
let _ = handle.emit("unread-changed", crate::commands::unread_list(&state));
let title = if n == 1 { "1 new".to_string() } else { format!("{n} new") };
notify(&handle, &from, &name, &title, &format!("{total} unread"), String::new());
}
@@ -340,6 +349,76 @@ fn keep_running_while_covered(handle: &AppHandle, app_id: &str) {
#[cfg(not(target_os = "macos"))]
fn keep_running_while_covered(_: &AppHandle, _: &str) {}
/// A still of one app, as a PNG data URL, for the shell to blur behind a dialog.
///
/// A dialog is drawn by the shell webview, and every app's webview is a native
/// view that paints above it — so an app has to be moved out of the way before
/// a dialog can be seen at all, and once it is moved there is nothing left to
/// blur. A still taken on the way out is the only way to keep the background
/// there. Deliberately small: it is going behind a blur.
#[cfg(target_os = "macos")]
pub fn snapshot(handle: &AppHandle, app_id: &str) -> Option<String> {
use block2::RcBlock;
use objc2_app_kit::{NSBitmapImageFileType, NSBitmapImageRep, NSImage};
use objc2_foundation::{
MainThreadMarker, NSDataBase64EncodingOptions, NSDictionary, NSError, NSNumber,
};
use objc2_web_kit::{WKSnapshotConfiguration, WKWebView};
let wv = handle.get_webview(&label_for(app_id))?;
let (tx, rx) = std::sync::mpsc::channel::<Option<String>>();
let sent = wv.with_webview(move |platform| unsafe {
let ptr = platform.inner() as *const WKWebView;
let Some(mtm) = MainThreadMarker::new() else {
let _ = tx.send(None);
return;
};
if ptr.is_null() {
let _ = tx.send(None);
return;
}
let webview: &WKWebView = &*ptr;
let config = WKSnapshotConfiguration::new(mtm);
config.setSnapshotWidth(Some(&NSNumber::new_f64(640.0)));
let handler = RcBlock::new(move |image: *mut NSImage, _error: *mut NSError| {
let encoded = (|| {
let image = image.as_ref()?;
let tiff = image.TIFFRepresentation()?;
let rep = NSBitmapImageRep::imageRepWithData(&tiff)?;
let png = rep.representationUsingType_properties(
NSBitmapImageFileType::PNG,
&NSDictionary::new(),
)?;
Some(
png.base64EncodedStringWithOptions(NSDataBase64EncodingOptions::empty())
.to_string(),
)
})();
let _ = tx.send(encoded);
});
webview.takeSnapshotWithConfiguration_completionHandler(Some(&config), &handler);
});
if sent.is_err() {
return None;
}
// A snapshot that takes longer than this is not worth making someone wait
// for; the dialog opens over a plain backdrop instead.
rx.recv_timeout(std::time::Duration::from_millis(2500))
.ok()
.flatten()
.map(|b64| format!("data:image/png;base64,{b64}"))
}
#[cfg(not(target_os = "macos"))]
pub fn snapshot(_: &AppHandle, _: &str) -> Option<String> {
None
}
/// Turns on WKWebView's two-finger back and forward swipes.
///
/// wry supports it but Tauri does not expose it, so it is set on the native