pbek / QOwnNotes

QOwnNotes is a plain-text file notepad and todo-list manager with Markdown support and Nextcloud / ownCloud integration.
https://www.qownnotes.org/
GNU General Public License v2.0
4.59k stars 407 forks source link

Noticeable delay when opening "Link an url or note" dialog #2726

Closed zacstewart closed 1 year ago

zacstewart commented 1 year ago

This dialog takes a few seconds to open, which is enough of an annoyance when trying to link something that it takes me out of flow. I'm guessing it probably has to do with the "Link Note" feature because it has to fetch a list of notes. If that's the case, I think it'd be worth exploring a few options like

  1. Split the link URL and Note dialogs
  2. Make dialog open while Notes are being read and added to list asynchronously
  3. Add another "Quick link" keyboard shortcut that doesn't use a dialog. Just put brackets around my selection, parentheses at the end, and put my cursor between them. I recommend ctrl+k, because lots of applications already have that key binding for inserting links.

Expected behaviour

Dialog to link a URL opens instantly

Actual behaviour

Dialog takes a noticeable delay to open

Steps to reproduce

Output from the debug section in the settings dialog

Expand QOwnNotes Debug Information =========================== ## General Info **Current Date**: `Tue Feb 7 10:30:11 2023` **Version**: `22.9.2` **Build date**: `Oct 3 2022` **Build number**: `984` **Platform**: `linux` **Operating System**: `Arch Linux` **Build architecture**: `x86_64` **Current architecture**: `x86_64` **Release**: `AUR` **Qt Version (build)**: `5.15.6` **Qt Version (runtime)**: `5.15.8` **Portable mode**: `no` **Settings path / key**: `/home/zac/.config/PBE/QOwnNotes.conf` **Application database path**: `/home/zac/.local/share/PBE/QOwnNotes/QOwnNotes.sqlite` **Application arguments**: `QOwnNotes` **Qt Debug**: `0` **Locale (system)**: `en_US` **Locale (interface)**: *empty* **Primary screen resolution**: `1280x720` **Screen resolution(s)**: `1280x720, 1128x752` **Icon theme**: `hicolor` **Notes in current note folder**: `18` **Calendar items**: `0` **Enabled scripts**: `0` ## Server Info **serverUrl**: *empty* **appIsValid**: `no` **notesPathExists**: *empty* **connectionErrorMessage**: *empty* ## Spellchecking **Enabled**: `true` **Selected language**: `auto` **Language codes**: `en_US, en_US-large` **Language names**: `American English (United States), American English (United States) [large]` **Application dictionaries path**: `/home/zac/.local/share/PBE/QOwnNotes/dicts` ## Note folders **currentNoteFolderId**: `3` ### Note folder `default` **id**: `1` **isCurrent**: `no` **activeTagId**: `-1` **localPath**: `/home/zac/Documents/Notes` **remotePath**: `Notes` **cloudConnectionId**: `1` **isShowSubfolders**: `yes` **isUseGit**: `no` **allowDifferentNoteFileName**: `no` **activeNoteSubFolder name**: *empty* **database file**: `/home/zac/Documents/Notes/notes.sqlite` ### Note folder `Personal` **id**: `2` **isCurrent**: `no` **activeTagId**: `0` **localPath**: `/home/zac/Documents/Notes/Personal` **remotePath**: `Notes` **cloudConnectionId**: `1` **isShowSubfolders**: `yes` **isUseGit**: `no` **allowDifferentNoteFileName**: `no` **activeNoteSubFolder name**: *empty* **database file**: `/home/zac/Documents/Notes/Personal/notes.sqlite` ## Cloud connections ### Cloud connection `Default` **id**: `1` **isCurrent**: `yes` **serverUrl**: *empty* **username**: *empty* **accountId**: *empty* ## Enabled scripts ## Settings **AboutDialog/geometry** (QByteArray): `` **ActiveNoteHistoryItem** (NoteHistoryItem): `` **AttachmentDialog/geometry** (QByteArray): `` **Debug/fakeOldVersionNumber** (QString): `false` **Debug/fileLogging** (QString): `false` **DistractionFreeMode/isEnabled** (QString): `false` **DistractionFreeMode/menuBarGeometry** (QByteArray): `` **DistractionFreeMode/menuBarHeight** (QString): `20` **DistractionFreeMode/menuBarVisible** (QString): `true` **DistractionFreeMode/windowState** (QByteArray): `` **Editor/CurrentSchemaKey** (QString): `EditorColorSchema-6033d61b-cb96-46d5-a3a8-20d5172017eb` **Editor/autoBracketClosing** (QString): `false` **Editor/autoBracketRemoval** (QString): `false` **Editor/centerCursor** (QString): `false` **Editor/disableCursorBlinking** (QString): `false` **Editor/editorWidthInDFMOnly** (QString): `true` **Editor/highlightCurrentLine** (QString): `true` **Editor/indentSize** (QString): `4` **Editor/removeTrailingSpaces** (QString): `false` **Editor/showLineNumbers** (QString): `false` **Editor/useTabIndent** (QString): `false` **Editor/vimMode** (QString): `false` **FileDialog/LastPath** (QString): `/home/zac/Downloads` **FileDialog/LastPath-NoteHTMLExport** (QString): `/home/zac/Downloads` **FileDialog/LastPath-NoteMarkdownExport** (QString): `/home/zac/Downloads` **FileDialog/LastPath-NotePDFExport** (QString): `/home/zac` **ImageDialog/disableCopying** (QString): `false` **ImageDialog/geometry** (QByteArray): `` **LastUpdateCheck** (QDateTime): `2023-02-07T10:12:30.969` **LinkDialog/geometry** (QByteArray): `` **MainWindow/geometry** (QByteArray): `` **MainWindow/mainToolBar.iconSize** (QString): `24` **MainWindow/menuBarGeometry** (QByteArray): `` **MainWindow/noteSubFolderTreeWidgetExpandState-1** (QStringList): `S3 Global, Personal` **MainWindow/noteSubFolderTreeWidgetExpandState-3** (QStringList): *empty* **MainWindow/noteTextEdit.code.font** (QString): `monospace,9,-1,2,50,0,0,0,0,0` **MainWindow/noteTextEdit.font** (QString): `Sans Serif,9,-1,5,50,0,0,0,0,0` **MainWindow/noteTextView.code.font** (QString): `monospace,9,-1,2,50,0,0,0,0,0` **MainWindow/noteTextView.font** (QString): `Sans Serif,9,-1,5,50,0,0,0,0,0` **MainWindow/noteTextView.ignoreCodeFontSize** (QString): `true` **MainWindow/noteTextView.refreshDebounceTime** (QString): `600` **MainWindow/noteTextView.rtl** (QString): `false` **MainWindow/noteTextView.underline** (QString): `true` **MainWindow/noteTextView.useEditorStyles** (QString): `true` **MainWindow/noteTextView.useInternalExportStyling** (QString): `true` **MainWindow/showNotesFromAllNoteSubFolders** (bool): `false` **NoteDialog/geometry** (QByteArray): `` **NoteDialog/tabWidgetIndex** (QString): `1` **NoteFolder-1/NoteTabNameList** (QString): `Markdown Cheatsheet` **NoteFolder-1/NoteTabStickinessList**: *empty* **NoteFolder-1/NoteTabSubFolderPathDataList** (QString): *empty* **NoteFolder-2/NoteTabNameList** (QStringList): `2023-01 Japan, Projects, Writing Ideas, Building Consultancy` **NoteFolder-2/NoteTabStickinessList** (QStringList): *empty* **NoteFolder-2/NoteTabSubFolderPathDataList** (QStringList): `Travel, Work, Work, Work` **NoteFolder-3/NoteTabNameList** (QStringList): `Gumbo, Ongoing, Log 2023-01` **NoteFolder-3/NoteTabStickinessList** (QStringList): *empty* **NoteFolder-3/NoteTabSubFolderPathDataList** (QStringList): `, S3 Global, S3 Global` **NoteHistory-1** (QVariantList): `` **NoteHistory-2** (QVariantList): `` **NoteHistory-3** (QVariantList): `` **NoteHistoryCurrentIndex-1** (QString): `43` **NoteHistoryCurrentIndex-2** (int): `59` **NoteHistoryCurrentIndex-3** (int): `16` **PiwikClientId** (QString): `` **Printer/NotePDFExport** (QByteArray): `` **ScriptRepositoryDialog/geometry** (QByteArray): `` **ScriptRepositoryDialog/mainSplitterState** (QByteArray): `` **SearchEngineId** (QString): `2` **SettingsDialog/geometry** (QByteArray): `` **SettingsDialog/mainSplitterState** (QByteArray): `` **ShareDialog/geometry** (QByteArray): `` **ShowSystemTray** (QString): `false` **StartHidden** (QString): `false` **StoredImagesDialog/geometry** (QByteArray): `` **TableDialog/geometry** (QByteArray): `` **UpdateDialog/geometry** (QByteArray): `` **WelcomeDialog/geometry** (QByteArray): `` **acceptAllExternalModifications** (QString): `false` **allowNoteEditing** (bool): `true` **allowOnlyOneAppInstance** (QString): `true` **appMetrics/disableAppHeartbeat** (QString): `false` **appMetrics/disableTracking** (QString): `true` **appMetrics/notificationShown** (QString): `true` **automaticNoteFolderDatabaseClosing** (QString): `false` **checkSpelling** (bool): `true` **closeTodoListAfterSave** (QString): `false` **cryptoKey** (QString): `` **currentNoteFolderId** (int): `3` **currentWorkspace** (QString): `initial` **cursorWidth** (QString): `1` **darkMode** (QString): `false` **darkModeColors** (QString): `false` **darkModeIconTheme** (QString): `false` **darkModeTrayIcon** (QString): `false` **defaultNoteFileExtension** (QString): `md` **demoNotesCreated** (QString): `true` **disableAutomaticUpdateDialog** (QString): `true` **disableSavedSearchesAutoCompletion** (QString): `false` **dockWasInitializedOnce** (QString): `true` **enableNoteTree** (QString): `false` **enableSocketServer** (QString): `true` **enableWebAppSupport** (QString): `false` **externalEditorPath** (QString): *empty* **fullyHighlightedBlockquotes** (QString): `false` **gitCommitInterval** (QString): `30` **gitExecutablePath** (QString): *empty* **gitLogCommand** (QString): *empty* **guiFirstRunInit** (bool): `true` **ignoreAllExternalModifications** (QString): `false` **ignoreAllExternalNoteFolderChanges** (QString): `false` **ignoreNoteSubFolders** (QString): `^\.` **imageScaleDown** (QString): `false` **imageScaleDownMaximumHeight** (QString): `1024` **imageScaleDownMaximumWidth** (QString): `1024` **initialLayoutIdentifier** (QString): `1col` **insertTimeFormat** (QString): `yyyy-MM-dd` **interfaceFontSize** (QString): `11` **interfaceLanguage** (QString): *empty* **internalIconTheme** (QString): `false` **itemHeight** (QString): `15` **legacyLinking** (QString): `false` **localTrash/autoCleanupDays** (QString): `30` **localTrash/autoCleanupEnabled** (QString): `true` **localTrash/supportEnabled** (QString): `true` **markdownHighlightingEnabled** (QString): `true` **navigationPanelAutoSelect** (QString): `true` **navigationPanelHideSearch** (QString): `false` **networking/ignoreSSLErrors** (QString): `true` **networking/proxyType** (QString): `2` **newNoteAskHeadline** (QString): `false` **noteEditIsCentralWidget** (QString): `true` **noteFileExtensionList** (QStringList): `md, txt` **noteListPreview** (QString): `false` **noteSaveIntervalTime** (QString): `10` **noteSubfoldersPanelDisplayAsFullTree** (QString): `true` **noteSubfoldersPanelHideSearch** (QString): `false` **noteSubfoldersPanelOrder** (QString): `0` **noteSubfoldersPanelShowFullPath** (QString): `false` **noteSubfoldersPanelShowNotesRecursively** (QString): `false` **noteSubfoldersPanelShowRootFolderName** (QString): `true` **noteSubfoldersPanelSort** (QString): `0` **notesPanelOrder** (QString): `0` **notesPanelSort** (QString): `1` **notesPath** (QString): `/home/zac/Documents/Notes/Hop Labs` **notifyAllExternalModifications** (QString): `false` **overrideInterfaceFontSize** (QString): `false` **ownCloud/supportEnabled** (QString): `false` **ownCloud/todoCalendarBackend** (QString): `3` **ownCloud/todoCalendarCalDAVPassword** (QString): `` **ownCloud/todoCalendarCalDAVServerUrl** (QString): *empty* **ownCloud/todoCalendarCalDAVUsername** (QString): *empty* **ownCloud/todoCalendarCloudConnectionId** (QString): `1` **ownCloud/todoCalendarDisplayNameList**: *empty* **ownCloud/todoCalendarEnabledList**: *empty* **ownCloud/todoCalendarEnabledUrlList**: *empty* **ownCloud/todoCalendarUrlList**: *empty* **ownCloudInfo/appIsValid** (bool): `false` **ownCloudInfo/connectionErrorMessage** (QString): *empty* **ownCloudInfo/notesPathExistsText** (QString): *empty* **ownCloudInfo/serverVersion** (QString): *empty* **previousWorkspace** (QString): `rKHfcuBwuX9A` **recentNoteFolders** (QStringList): `/home/zac/Documents/Notes/Personal, /home/zac/Documents/Notes` **restoreCursorPosition** (QString): `true` **restoreLastNoteAtStartup** (QString): `true` **restoreNoteTabs** (QString): `true` **savedSearches/noteFolder-1** (QStringList): `Note 2022-08-01T17.22.22, Note 2022-07-01T15.43.07, Note 2022-07-01T15.18.21, Note 2022-06-13T11.33.31, Note 2022-06-12T12.25.10, Note 2022-06-10T15.35.20, discretize, Note 2022-06-06T10.24.49, Note 2022-05-23T14.57.47, Note 2022-05-18T11.02.31, Note 2022-05-16T08.09.33, Note 2022-05-16T07.38.42, Note 2022-05-13T15.59.39, Note 2022-05-05T16.45.21, Note 2022-05-03T16.06.11, Note 2022-05-03T15.58.31, Note 2022-05-03T15.57.25, Log 2022-05-03T15.21.17, hop, ongoing, Note 2022-05-03T12.00.49, Log 2022-05-03T10.16.41, Note 2022-05-03T10.04.03, Note 2022-05-02T14.50.00, Note 2022-05-02T14.48.19, Note 2022-05-02T14.47.12, Note 2022-05-02T14.43.01` **savedSearches/noteFolder-2** (QStringList): `Note 2023-01-27T11.15.47, Note 2023-01-07T17.43.34, Note 2023-01-02T15.15.14, Note 2022-12-25T22.48.45, Note 2022-12-25T22.45.18, Note 2022-12-25T22.44.56, Note 2022-12-25T22.31.28, Note 2022-12-12T13.41.39, Note 2022-10-29T13.34.19, Note 2022-10-27T16.08.14, Note 2022-10-26T22.20.28, Note 2022-10-14T17.07.54, Note 2022-09-27T07.52.05, Note 2022-09-27T07.37.43, Note 2022-09-19T04.17.19, Note 2022-09-14T22.15.43, Note 2022-09-11T05.40.12, Note 2022-09-11T05.31.51, Note 2022-08-05T10.44.33, Note 2022-07-19T12.01.44, Note 2022-07-10T14.33.19, Note 2022-07-04T21.40.35, Note 2022-07-04T21.09.46, Note 2022-07-01T14.10.29, Note 2022-07-01T14.05.17` **savedSearches/noteFolder-3** (QStringList): `Note 2023-02-02T22.06.14, Note 2023-01-03T15.23.50, Note 2022-12-01T11.37.55, Note 2022-11-01T22.07.13, Note 2022-10-04T13.49.43, Note 2022-09-01T20.33.09, Note 2022-08-04T15.43.25, Note 2022-07-18T10.37.51, Note 2022-07-01T15.45.13, Note 2022-07-01T15.43.47, Note 2022-07-01T15.43.40` **showMatches** (QString): `true` **showMenuBar** (bool): `true` **showStatusBar** (bool): `true` **spellCheckLanguage** (QString): `auto` **systemIconTheme** (QString): `false` **tagWasAddedToNote** (QString): `true` **taggingShowNotesRecursively** (QString): `false` **tagsPanelHideNoteCount** (QString): `false` **tagsPanelHideSearch** (QString): `false` **tagsPanelOrder** (QString): `0` **tagsPanelSort** (QString): `0` **todoCalendarSupport** (QString): `true` **toolbar/1/items** (QStringList): `action_New_note, action_Find_note, action_Remove_note, action_Open_note_in_external_editor, actionShow_local_trash, actionAllow_note_editing, , action_Back_in_note_history, action_Forward_in_note_history, , action_Find_text_in_note, actionReplace_in_current_note, , actionShow_versions, actionShow_trash, actionShare_note, , actionShow_Todo_List` **toolbar/1/name** (QString): `mainToolBar` **toolbar/1/title** (QString): `main toolbar` **toolbar/2/items** (QStringList): `actionFormat_text_bold, actionFormat_text_italic, actionStrike_out_text, actionInsert_code_block, actionInsert_block_quote` **toolbar/2/name** (QString): `formattingToolbar` **toolbar/2/title** (QString): `formatting toolbar` **toolbar/3/items** (QStringList): `actionInsert_text_link, actionInsert_image, actionInsert_current_time` **toolbar/3/name** (QString): `insertingToolbar` **toolbar/3/title** (QString): `inserting toolbar` **toolbar/4/items** (QStringList): `action_Encrypt_note, actionEdit_encrypted_note, actionDecrypt_note` **toolbar/4/name** (QString): `encryptionToolbar` **toolbar/4/title** (QString): `encryption toolbar` **toolbar/5/items** (QStringList): `actionWorkspaceComboBox, actionStore_as_new_workspace, actionRemove_current_workspace, actionRename_current_workspace, actionSwitch_to_previous_workspace, actionUnlock_panels, , actionToggle_distraction_free_mode, action_Increase_note_text_size, action_Decrease_note_text_size, action_Reset_note_text_size` **toolbar/5/name** (QString): `windowToolbar` **toolbar/5/title** (QString): `window toolbar` **toolbar/6/items** (QString): `action_Quit` **toolbar/6/name** (QString): `quitToolbar` **toolbar/6/title** (QString): `quit toolbar` **toolbar/size** (QString): `6` **useNoteFolderButtons** (QString): `false` **useUNIXNewline** (QString): `false` **webAppClientService/serverUrl** (QString): `wss://app.qownnotes.org` **webAppClientService/token** (QString): `` **webSocketServerService/bookmarksNoteName** (QString): `Bookmarks` **webSocketServerService/bookmarksTag** (QString): `bookmarks` **webSocketServerService/commandSnippetsNoteName** (QString): `Commands` **webSocketServerService/commandSnippetsTag** (QString): `commands` **webSocketServerService/port** (QString): `22222` **webSocketServerService/token** (QString): `` **workspace-initial/name** (QString): `Full` **workspace-initial/noteSubFolderDockWidgetVisible** (QString): `true` **workspace-initial/windowState** (QByteArray): `` **workspace-rKHfcuBwuX9A/name** (QString): `Single column` **workspace-rKHfcuBwuX9A/noteSubFolderDockWidgetVisible** (QString): `true` **workspace-rKHfcuBwuX9A/windowState** (QByteArray): `` **workspaces** (QStringList): `initial, rKHfcuBwuX9A` ## System environment **SHELL**: `/bin/bash` **GDK_DPI_SCALE**: `0.85` **HISTCONTROL**: `ignoredups:erasedups` **GTK_IM_MODULE**: `fcitx` **HISTSIZE**: `100000` **I3SOCK**: `/run/user/1000/i3/ipc-socket.919` **SSH_AUTH_SOCK**: `/tmp/ssh-XXXXXXsqGq9A/agent.804` **XMODIFIERS**: `@im=fcitx` **SSH_AGENT_PID**: `808` **CLOUDSDK_PYTHON_ARGS**: `-S` **EDITOR**: `nvim` **XDG_SEAT**: `seat0` **PWD**: `/home/zac` **LOGNAME**: `zac` **XDG_SESSION_TYPE**: `tty` **SYSTEMD_EXEC_PID**: `610` **_**: `/usr/bin/QOwnNotes` **XAUTHORITY**: `/home/zac/.Xauthority` **WINDOWPATH**: `1` **MOTD_SHOWN**: `pam` **HOME**: `/home/zac` **LANG**: `en_US.UTF-8` **CLOUDSDK_ROOT_DIR**: `/opt/google-cloud-sdk` **INVOCATION_ID**: `b4ee2ea031ac4d05bac285434eebc750` **CLOUDSDK_PYTHON**: `/usr/bin/python` **NVM_DIR**: `/home/zac/.nvm` **XDG_SESSION_CLASS**: `user` **TERM**: `linux` **GOOGLE_CLOUD_SDK_HOME**: `/opt/google-cloud-sdk` **USER**: `zac` **CUDA_PATH**: `/opt/cuda` **DISPLAY**: `:0` **SHLVL**: `3` **MOZ_USE_XINPUT2**: `1` **QT_IM_MODULE**: `fcitx` **XDG_VTNR**: `1` **XDG_SESSION_ID**: `1` **MOZ_PLUGIN_PATH**: `/usr/lib/mozilla/plugins` **XDG_RUNTIME_DIR**: `/run/user/1000` **DEBUGINFOD_URLS**: `https://debuginfod.archlinux.org ` **PATH**: `/opt/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cuda/bin:/opt/cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl` **HISTFILESIZE**: `100000` **DBUS_SESSION_BUS_ADDRESS**: `unix:path=/run/user/1000/bus` **MAIL**: `/var/spool/mail/zac`
pbek commented 1 year ago

Notice few-second delay before dialog opens

The dialog opens instantly for me. The only thing that may take time is when you have a URL in the clipboard, then the dialog is (synchronically) trying to fetch the content to get the title of the page as name.

pbek commented 1 year ago

Add another "Quick link" keyboard shortcut that doesn't use a dialog. Just put brackets around my selection, parentheses at the end, and put my cursor between them. I recommend ctrl+k, because lots of applications already have that key binding for inserting links.

You could write that as a script (and share it with the script repository šŸ˜‰ ). You just need a custom action, the clipboard method and noteTextEditWrite. See https://www.qownnotes.org/scripting/methods-and-objects.html Custom actions can be assigned shortcuts too...

pbek commented 1 year ago

Make dialog open while Notes are being read and added to list asynchronously

How many notes do you have in your note folder? I have 1000 and have no lag... Are you sure that is the source of your delay?

zacstewart commented 1 year ago

The only thing that may take time is when you have a URL in the clipboard, then the dialog is (chronically) trying to fetch the content to get the title of the page as name.

That makes perfect sense. My thought about notes was wild speculation, sorry. I didn't realize it was fetching the URL to get the page title.

I like your suggestion about writing a script. I may give it a try, I love QOwnNotes, so I wouldn't mind investing in the scripting ecosystem.

I still suggest coming up with a way to make that dialog open instantly even when it wants to fetch a URL. 99% of the time, I don't care about the title, I just want to select, ctrl-l, paste, enter as one muscle memory movement. I hate waiting for something to give me back control while I'm in the flow of writing. My personal preference would be a button on the dialog that says something like "Fetch link title". It seems less convenient, but for someone like me, I'd rather have a deterministic keyboard pattern even if it's more strokes than something automatic but requires me to halt and visually poll for the UI to be ready again.

pbek commented 1 year ago

"Fetch link title".

Yes, but that would be an extra click for everyone for a 1% of the time use-case šŸ˜ What do you need from the link dialog anyway? Something that writes the [title](link) pattern? I'd rather do that with a script... You can even have input dialogs (to ask for a title) in scripts. You even can implement the page-fetching and parsing in a script... I created APIs for all that. šŸ˜€

pbek commented 1 year ago

https://github.com/qownnotes/scripts can give you a good inspiration for your link script.

pbek commented 1 year ago

But I'll make that title guessing an asynchronous process...

pbek commented 1 year ago

23.2.1

pbek commented 1 year ago

There now is a new release, could you please test it and report if it works for you?

zacstewart commented 1 year ago

Built and gave it a try. It works great! Thanks for the awesome work

pbek commented 1 year ago

Great, thank you for testing! šŸ˜‰