feat(desktop): add Quick Entry overlay with global shortcut#2340
feat(desktop): add Quick Entry overlay with global shortcut#2340
Conversation
fafe90a to
7860abd
Compare
|
auggie review |
🤖 Augment PR SummarySummary: Adds a global-hotkey “Quick Entry” overlay to the Electron desktop app for rapid task creation without switching to the main window. Changes:
Technical Notes: Windows run with 🤖 Was this summary useful? React with 👍 or 👎 |
desktop/main.js
Outdated
| return { action: 'deny' }; | ||
| }); | ||
| mainWindow.webContents.setWindowOpenHandler(({url}) => { | ||
| shell.openExternal(url) |
There was a problem hiding this comment.
| }, | ||
| }) | ||
|
|
||
| quickEntryWindow.loadURL(`http://127.0.0.1:${serverPort}/?mode=quick-add`) |
There was a problem hiding this comment.
The quick-entry window doesn’t set a webContents.setWindowOpenHandler, so window.open/target=_blank behavior may differ from the main window; consider applying the same “deny + safe external open” policy here as well.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
desktop/main.js
Outdated
| // On macOS it's common to re-create a window in the app when the | ||
| // dock icon is clicked and there are no other windows open. | ||
| if (BrowserWindow.getAllWindows().length === 0) createWindow() | ||
| globalShortcut.register('CmdOrCtrl+Shift+A', toggleQuickEntry) |
There was a problem hiding this comment.
…indow open handler to quick-entry, log shortcut registration failure
|
Things to fix:
|
Emit opened/closed events when the help modal is toggled, so parent components can react (e.g. resize the quick entry window).
…lers - Move QuickAddMagic inside .action-input so the help icon sits inline with the input instead of on a new line - Focus the input via nextTick when quick-add mode activates - Add onHelpOpened/onHelpClosed to resize the quick entry window when the help modal is toggled
…ocus - Reduce initial window height from 500px to 120px so it only shows the input bar without excess space - Add quick-entry:resize IPC channel so the frontend can expand the window when the help modal opens and collapse it when closed - Wait for did-finish-load before showing/focusing the window so the input gets properly focused on each invocation
The v-focus directive fires when the input mounts, but in the Electron quick entry window the page loads before the window is shown. This means focus() is called on a hidden window and has no effect. Now check document.hasFocus() and if the window isn't focused yet, defer the focus call to when the window receives focus.
The previous approach using nextTick and window focus events didn't work because the Modal transition (v-if + Transition appear) and the Electron window visibility timing both prevent immediate focus. Use requestAnimationFrame to retry until focus actually lands on the input.
|
auggie review |
Preview DeploymentPreview deployments for this PR are available at:
The preview environment will start automatically on first visit. Subsequent pushes to this PR will update the Run locally with Dockerdocker pull ghcr.io/go-vikunja/vikunja:pr-2340
docker run -p 3456:3456 ghcr.io/go-vikunja/vikunja:pr-2340Last updated for commit 3c4804b |
| searchInput.value.focus() | ||
| if (document.activeElement === searchInput.value) return | ||
| } | ||
| requestAnimationFrame(tryFocus) |
There was a problem hiding this comment.
The requestAnimationFrame(tryFocus) loop has no cancellation/stop condition if active flips back to false or the component unmounts before focus lands; this can keep scheduling frames indefinitely. Consider adding a guard/cleanup so the focus retry loop terminates when the overlay closes.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
|
||
| ipcMain.on('quick-entry:resize', (_event, width, height) => { | ||
| if (quickEntryWindow) { | ||
| quickEntryWindow.setSize(width, height) |
There was a problem hiding this comment.
quick-entry:resize accepts width/height from the renderer and passes them straight to setSize; if these aren’t finite positive integers (or are extremely large), Electron may throw or behave poorly. Consider validating/clamping the values before applying them.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
|
@kolaente Hey! Thank you for this draft.
|
|
Hey @executed, these are great points.
I think the best way to make that work would be to have it open the task detail view when creating the task by pressing +1 for making the shortcut configurable. It should be possible to do this from Vikunja's settings. |
Summary
CmdOrCtrl+Shift+A) to the Electron desktop app for fast task creation without switching to the main windowQuickActions.vuecomponent, auto-selecting "New Task" mode in the overlayBroadcastChannelAPI to notify the main window to refresh after task creation from the overlayNew files
desktop/preload-quick-entry.jswindow.quickEntry.close()IPCfrontend/src/composables/useQuickAddMode.ts?mode=quick-addURL paramfrontend/src/components/quick-actions/QuickAddOverlay.vuefrontend/src/types/quick-entry.d.tswindow.quickEntryModified files
desktop/main.jsdesktop/package.jsonfilesarray to electron-builder configfrontend/src/App.vue?mode=quick-addto QuickAddOverlay, transparent backgroundfrontend/src/components/quick-actions/QuickActions.vuefrontend/src/components/home/ContentAuth.vuefrontend/src/i18n/lang/en.jsonquickActions.notLoggedIntranslation keyTest plan
CmdOrCtrl+Shift+Aopens quick entry overlay centered in upper third