fix(windows): merge taskbar icon (AUMID) + focus window on notification click
Taskbar showed two icons because the AppUserModelID was (a) set too late — after the main window was built, so its taskbar button grouped under a mismatched implicit AUMID — and (b) valued 'LotusGuild.LotusChat', which differs from the bundle identifier 'org.lotusguild.lotus-chat' that Tauri's NSIS installer stamps on its shortcuts. Fix both: set the AUMID at the top of run() before the window is built (new set_process_aumid, split out of ensure_app_user_model_id), and align the constant to the bundle identifier so the running window and a pinned installer shortcut group together. Notification click didn't raise the window: add a focus_main_window command (reuses show_main) for the web/service-worker path, and call show_main directly in the rich-toast Activated body-click handler. Note: existing users who pinned the old mis-grouped icon may need to re-pin once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -466,7 +466,20 @@ fn flash_window(window: tauri::Window) -> Result<(), String> {
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Bring the main window to the foreground. Invoked from the web side when a
|
||||
/// notification is clicked — the service-worker/page path can't raise the native
|
||||
/// OS window on its own (a WebView2 `client.focus()` only focuses the document).
|
||||
#[tauri::command]
|
||||
fn focus_main_window(app: tauri::AppHandle) {
|
||||
show_main(&app);
|
||||
}
|
||||
|
||||
pub fn run() {
|
||||
// Advertise the process AUMID BEFORE the main window is built (in `.setup`,
|
||||
// below) so the window's taskbar button groups under the same identity as the
|
||||
// pinned installer shortcut. Must precede the WebviewWindowBuilder.
|
||||
native::aumid::set_process_aumid();
|
||||
|
||||
let port: u16 = 44548;
|
||||
let context = tauri::generate_context!();
|
||||
|
||||
@@ -492,6 +505,7 @@ pub fn run() {
|
||||
set_tray_unread,
|
||||
get_tray_dnd,
|
||||
flash_window,
|
||||
focus_main_window,
|
||||
send_notification,
|
||||
check_for_update,
|
||||
install_update,
|
||||
|
||||
Reference in New Issue
Block a user