feat: add general assist feature and enhance shortcut management

- Introduced a new "General Assist" shortcut, allowing users to open SurfSense from anywhere.
- Updated shortcut management to include the new general assist functionality in both the desktop and web applications.
- Enhanced the UI to reflect changes in shortcut labels and descriptions for better clarity.
- Improved the Electron API to support the new shortcut configuration.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-07 03:42:46 -07:00
parent e574b5ec4a
commit 27e9e8d873
10 changed files with 159 additions and 33 deletions

View file

@ -1,7 +1,9 @@
import { app, BrowserWindow } from 'electron';
let isQuitting = false;
import { registerGlobalErrorHandlers, showErrorDialog } from './modules/errors';
import { startNextServer } from './modules/server';
import { createMainWindow } from './modules/window';
import { createMainWindow, getMainWindow } from './modules/window';
import { setupDeepLinks, handlePendingDeepLink } from './modules/deep-links';
import { setupAutoUpdater } from './modules/auto-updater';
import { setupMenu } from './modules/menu';
@ -9,6 +11,7 @@ import { registerQuickAsk, unregisterQuickAsk } from './modules/quick-ask';
import { registerAutocomplete, unregisterAutocomplete } from './modules/autocomplete';
import { registerFolderWatcher, unregisterFolderWatcher } from './modules/folder-watcher';
import { registerIpcHandlers } from './ipc/handlers';
import { createTray, destroyTray } from './modules/tray';
registerGlobalErrorHandlers();
@ -28,7 +31,18 @@ app.whenReady().then(async () => {
return;
}
createMainWindow('/dashboard');
await createTray();
const win = createMainWindow('/dashboard');
// Minimize to tray instead of closing the app
win.on('close', (e) => {
if (!isQuitting) {
e.preventDefault();
win.hide();
}
});
await registerQuickAsk();
await registerAutocomplete();
registerFolderWatcher();
@ -37,20 +51,28 @@ app.whenReady().then(async () => {
handlePendingDeepLink();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
const mw = getMainWindow();
if (!mw || mw.isDestroyed()) {
createMainWindow('/dashboard');
} else {
mw.show();
mw.focus();
}
});
});
// Keep running in the background — the tray "Quit" calls app.exit()
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
// Do nothing: the app stays alive in the tray
});
app.on('before-quit', () => {
isQuitting = true;
});
app.on('will-quit', () => {
unregisterQuickAsk();
unregisterAutocomplete();
unregisterFolderWatcher();
destroyTray();
});