fix: notification click now navigates to affected session

switchToSession didn't exist - was calling a nonexistent method.
Changed to selectSession which actually switches the active tab and
loads the terminal buffer. Also enhanced browser push notifications
to navigate to the session when clicked (previously only focused window).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-01-24 03:33:56 +01:00
co-authored by Claude Opus 4.5
parent d516609af5
commit 4979df4a9f
+6 -3
View File
@@ -106,7 +106,7 @@ class NotificationManager {
// Layer 3: Browser notification (when tab hidden, critical/warning only)
if (!this.isTabVisible && (urgency === 'critical' || urgency === 'warning')) {
this.sendBrowserNotif(title, message, category);
this.sendBrowserNotif(title, message, category, sessionId);
}
// Layer 4: Audio alert (critical only)
@@ -181,7 +181,7 @@ class NotificationManager {
}
// Layer 3: Web Notification API
sendBrowserNotif(title, body, tag) {
sendBrowserNotif(title, body, tag, sessionId) {
if (!this.preferences.browserNotifications) return;
if (typeof Notification === 'undefined') return;
if (Notification.permission !== 'granted') return;
@@ -200,6 +200,9 @@ class NotificationManager {
notif.onclick = () => {
window.focus();
if (sessionId && this.app.sessions.has(sessionId)) {
this.app.selectSession(sessionId);
}
notif.close();
};
@@ -268,7 +271,7 @@ class NotificationManager {
// Switch to session if available
if (notif.sessionId && this.app.sessions.has(notif.sessionId)) {
this.app.switchToSession(notif.sessionId);
this.app.selectSession(notif.sessionId);
this.toggleDrawer();
}