QOwnNotes icon indicating copy to clipboard operation
QOwnNotes copied to clipboard

[I] Global keyboard shortcuts not working in KDE Wayland

Open mickenorlen opened this issue 3 years ago • 13 comments

Expected behaviour

Global keyboard shortcuts work

Actual behaviour

Global keyboard shortcuts have no effect

Steps to reproduce

Set global keyboard shortcut for example to show/hide application.

Information about the application, settings and environment

Expand

QOwnNotes Debug Information

General Info

Current Date: tis feb. 15 20:03:50 2022 Version: 22.2.2 Build date: Feb 8 2022 Build number: 946 Platform: linux Operating System: Arch Linux Build architecture: x86_64 Current architecture: x86_64 Release: OBS Qt Version (build): 5.15.2 Qt Version (runtime): 5.15.2 Portable mode: no Settings path / key: /home/micke/.config/PBE/QOwnNotes.conf Application database path: /home/micke/.local/share/PBE/QOwnNotes/QOwnNotes.sqlite Application arguments: /usr/bin/QOwnNotes Qt Debug: 0 Locale (system): en_US Locale (interface): empty Primary screen resolution: 1280x720 Icon theme: breeze-dark Notes in current note folder: 25 Calendar items: 1 Enabled scripts: 0

Server Info

serverUrl: https://cloud.orbcoding.com appIsValid: yes notesPathExists: yes serverVersion: 23.0.1.2 appVersion: empty

Spellchecking

Enabled: false Selected language: auto Language codes: en_US, en_US-large, it_CH, it_IT, sv_FI, sv_SE Language names: American English (United States), American English (United States) [large], italiano (Svizzera), italiano (Italia), svenska (Finland), svenska (Sverige) Application dictionaries path: /home/micke/.local/share/PBE/QOwnNotes/dicts

Note folders

currentNoteFolderId: 1

Note folder default

id: 1 isCurrent: yes activeTagId: 0 localPath: /home/micke/Nextcloud/Notes remotePath: Notes cloudConnectionId: 1 isShowSubfolders: yes isUseGit: no allowDifferentNoteFileName: no activeNoteSubFolder name: orb database file: /home/micke/Nextcloud/Notes/notes.sqlite

Cloud connections

Cloud connection Default

id: 1 isCurrent: yes serverUrl: https://cloud.orbcoding.com username: mickenorlen accountId: mickenorlen

Enabled scripts

Settings

ActiveNoteHistoryItem (NoteHistoryItem): <binary data> Debug/fakeOldVersionNumber (bool): false Debug/fileLogging (bool): false DistractionFreeMode/isEnabled (QString): false DistractionFreeMode/menuBarGeometry (QByteArray): <binary data> DistractionFreeMode/menuBarHeight (QString): 30 DistractionFreeMode/menuBarVisible (QString): true DistractionFreeMode/windowState (QByteArray): <binary data> Editor/CurrentSchemaKey (QString): EditorColorSchema-cdbf28fc-1ddc-4d13-bb21-6a4043316a2f Editor/autoBracketClosing (bool): true Editor/autoBracketRemoval (bool): true Editor/disableCursorBlinking (bool): true Editor/editorWidthInDFMOnly (bool): true Editor/highlightCurrentLine (bool): true Editor/indentSize (int): 2 Editor/removeTrailingSpaces (bool): true Editor/showLineNumbers (bool): true Editor/useTabIndent (bool): false Editor/vimMode (bool): false FileDialog/LastPath (QString): /home/micke/Nextcloud/Documents FileDialog/LastPath-SettingsExport (QString): /home/micke/Nextcloud/Documents GlobalShortcuts/MainWindow-actionShow_Hide_application (QKeySequence): Ctrl+Ö IssueAssistantDialog/geometry (QByteArray): <binary data> LastUpdateCheck (QDateTime): 2022-02-15T19:34:03.233 LinkDialog/geometry (QByteArray): <binary data> LogWidget/criticalLog (bool): true LogWidget/debugLog (bool): true LogWidget/fatalLog (bool): true LogWidget/infoLog (bool): true LogWidget/scriptingLog (bool): true LogWidget/statusLog (bool): true LogWidget/warningLog (bool): true MainWindow/geometry (QByteArray): <binary data> MainWindow/mainToolBar.iconSize (int): 22 MainWindow/menuBarGeometry (QByteArray): <binary data> MainWindow/noteSubFolderTreeWidgetExpandState-1 (QStringList): Dev/Projects, Dev MainWindow/noteTextEdit.code.font (QString): Hack,9,-1,7,50,0,0,0,0,0 MainWindow/noteTextEdit.font (QString): Noto Sans,9,-1,0,50,0,0,0,0,0 MainWindow/noteTextView.code.font (QString): Hack,10,-1,7,50,0,0,0,0,0 MainWindow/noteTextView.font (QString): Noto Sans,10,-1,0,50,0,0,0,0,0 MainWindow/noteTextView.ignoreCodeFontSize (bool): true MainWindow/noteTextView.rtl (bool): false MainWindow/noteTextView.underline (bool): true MainWindow/noteTextView.useEditorStyles (bool): true MainWindow/noteTextView.useInternalExportStyling (bool): true MainWindow/showNotesFromAllNoteSubFolders (QString): false MessageBoxOverride/readonly-mode-allow (QString): 16384 NoteDiffDialog/geometry (QByteArray): <binary data> NoteFolder-1/NoteTabNameList (QStringList): Orb changes, Sticky NoteFolder-1/NoteTabStickinessList (QStringList): empty NoteFolder-1/NoteTabSubFolderPathDataList (QStringList):

Dev, Dev
orb

NoteFolder-1/allowDifferentNoteFileName (QString): false NoteHistory-1 (QVariantList): <variant list with 66 item(s)> NoteHistoryCurrentIndex-1 (int): 65 PiwikClientId (QString): <hidden> ScriptRepositoryDialog/mainSplitterState (QByteArray): <binary data> SearchEngineId (int): 2 SettingsDialog/geometry (QByteArray): <binary data> SettingsDialog/mainSplitterState (QByteArray): <binary data> Shortcuts/MainWindow-actionFind_action (QKeySequence): Ctrl+Shift+P Shortcuts/MainWindow-actionShow_Todo_List (QKeySequence): Meta+T Shortcuts/MainWindow-action_Print_note_markdown (QKeySequence): empty Shortcuts/MainWindow-togglePanel-notePreviewDockWidget (QKeySequence): F3 ShowSystemTray (bool): false StartHidden (bool): false TodoDialog/geometry (QByteArray): <binary data> TodoDialog/mainSplitterState (QByteArray): <binary data> TodoDialog/showCompletedItems (QString): 2 TodoDialog/showDueTodayItemsOnly (QString): 0 TodoDialog/todoListSelectorSelectedItem (QString): Home WelcomeDialog/geometry (QByteArray): <binary data> acceptAllExternalModifications (bool): false allowNoteEditing (bool): true allowOnlyOneAppInstance (bool): true appMetrics/disableAppHeartbeat (bool): false appMetrics/disableTracking (bool): false appMetrics/notificationShown (QString): true automaticNoteFolderDatabaseClosing (bool): false checkSpelling (QString): false closeTodoListAfterSave (bool): false cryptoKey (QString): <hidden> currentNoteFolderId (QString): 1 currentWorkspace (QString): initial cursorWidth (int): 1 darkMode (bool): true darkModeColors (bool): true darkModeIconTheme (bool): true darkModeTrayIcon (bool): true defaultNoteFileExtension (QString): md demoNotesCreated (QString): true disableAutomaticUpdateDialog (bool): true disableSavedSearchesAutoCompletion (bool): false dockWasInitializedOnce (QString): true enableNoteTree (bool): false enableSocketServer (bool): true enableWebAppSupport (bool): false externalEditorPath (QString): empty fullyHighlightedBlockquotes (bool): false gitCommitInterval (int): 30 gitExecutablePath (QString): empty gitLogCommand (QString): empty guiFirstRunInit (bool): true ignoreAllExternalModifications (bool): false ignoreAllExternalNoteFolderChanges (bool): false ignoreNoteSubFolders (QString): ^\. imageScaleDown (bool): false imageScaleDownMaximumHeight (int): 1024 imageScaleDownMaximumWidth (int): 1024 initialLayoutIdentifier (QString): minimal insertTimeFormat (QString): empty interfaceFontSize (int): 11 interfaceLanguage (QString): empty interfaceStyle (QString): Breeze internalIconTheme (bool): false itemHeight (int): 24 legacyLinking (bool): false localTrash/autoCleanupDays (int): 30 localTrash/autoCleanupEnabled (bool): true localTrash/supportEnabled (bool): true markdownHighlightingEnabled (bool): true navigationPanelAutoSelect (bool): true navigationPanelHideSearch (bool): false networking/ignoreSSLErrors (bool): true networking/proxyType (int): 2 newNoteAskHeadline (bool): false noteEditIsCentralWidget (bool): true noteFileExtensionList (QStringList): md, txt noteListPreview (bool): false noteSaveIntervalTime (int): 10 noteSubfoldersPanelDisplayAsFullTree (bool): true noteSubfoldersPanelHideSearch (bool): false noteSubfoldersPanelOrder (int): 0 noteSubfoldersPanelShowFullPath (bool): false noteSubfoldersPanelShowNotesRecursively (bool): false noteSubfoldersPanelShowRootFolderName (bool): true noteSubfoldersPanelSort (int): 0 notesPanelOrder (int): 0 notesPanelSort (int): 1 notesPath (QString): /home/micke/Nextcloud/Notes notifyAllExternalModifications (bool): false overrideInterfaceFontSize (bool): false ownCloud/supportEnabled (bool): true ownCloud/todoCalendarBackend (int): 3 ownCloud/todoCalendarCalDAVPassword (QString): <hidden> ownCloud/todoCalendarCalDAVServerUrl (QString): empty ownCloud/todoCalendarCalDAVUsername (QString): empty ownCloud/todoCalendarCloudConnectionId (int): 1 ownCloud/todoCalendarDisplayNameList (QStringList): Home, Dev ownCloud/todoCalendarEnabledList (QStringList): Home, Dev ownCloud/todoCalendarEnabledUrlList (QStringList): https://cloud.orbcoding.com/remote.php/dav/calendars/mickenorlen/home-1/, https://cloud.orbcoding.com/remote.php/dav/calendars/mickenorlen/dev-2/ ownCloud/todoCalendarUrlList (QStringList): https://cloud.orbcoding.com/remote.php/dav/calendars/mickenorlen/home-1/, https://cloud.orbcoding.com/remote.php/dav/calendars/mickenorlen/dev-2/ ownCloudInfo/appIsValid (bool): true ownCloudInfo/connectionErrorMessage (QString): Unknown error ownCloudInfo/notesPathExistsText (QString): yes ownCloudInfo/serverVersion (QString): 23.0.1.2 restoreCursorPosition (bool): true restoreLastNoteAtStartup (bool): true restoreNoteTabs (bool): true savedSearches/noteFolder-1 (QStringList): Note 2022-02-08T14.55.35, Note 2022-02-08T14.54.13, Note 2022-02-08T14.51.10, Note 2022-02-08T14.44.10, Note 2022-02-02T21.33.10, Note 2022-02-02T21.33.01, Note 2022-01-28T22.11.28, Note 2022-01-28T18.25.13, Note 2022-01-26T14.36.19, Note 2022-01-26T13.55.22, Note 2022-01-26T13.43.10, Note 2022-01-25T10.24.33, Note 2022-01-23T09.37.37, Note 2022-01-23T09.31.21, Note 2022-01-19T18.33.18, Note 2022-01-19T16.19.23, Note 2022-01-19T16.19.08, Note 2022-01-19T16.01.03, Note 2022-01-17T23.36.58, Note 2022-01-17T20.14.04, Note 2022-01-17T17.31.11, Note 2022-01-16T16.42.16, Note 2022-01-16T00.59.27, Note 2022-01-14T13.14.54, Note 2022-01-12T19.45.35, Sticky showMatches (bool): true showMenuBar (bool): true showStatusBar (bool): true spellCheckLanguage (QString): auto systemIconTheme (bool): true taggingShowNotesRecursively (bool): false tagsPanelHideNoteCount (bool): false tagsPanelHideSearch (bool): false tagsPanelOrder (int): 0 tagsPanelSort (int): 0 todoCalendarSupport (bool): 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 (QStringList): action_Quit toolbar/6/name (QString): quitToolbar toolbar/6/title (QString): quit toolbar toolbar/size (int): 6 useNoteFolderButtons (bool): false useUNIXNewline (bool): false webAppClientService/serverUrl (QString): wss://app.qownnotes.org webAppClientService/token (QString): <hidden> webSocketServerService/bookmarksNoteName (QString): Bookmarks webSocketServerService/bookmarksTag (QString): bookmarks webSocketServerService/commandSnippetsNoteName (QString): Commands webSocketServerService/commandSnippetsTag (QString): commands webSocketServerService/port (int): 22222 workspace-initial/name (QString): Minimal workspace-initial/noteSubFolderDockWidgetVisible (QString): true workspace-initial/windowState (QByteArray): <binary data> workspaces (QString): initial

System environment

SHELL: /bin/zsh XDG_SESSION_PATH: /org/freedesktop/DisplayManager/Session0 DOTNET_ROOT: /usr/share/dotnet SSH_AUTH_SOCK: "$XDG_RUNTIME_DIR/ssh-agent.socket" DESKTOP_SESSION: plasmawayland XDG_SEAT: seat0 PWD: /home/micke LOGNAME: micke XDG_SESSION_DESKTOP: KDE XDG_SESSION_TYPE: wayland MOTD_SHOWN: pam HOME: /home/micke LANG: en_US.UTF-8 XDG_CURRENT_DESKTOP: KDE XDG_SEAT_PATH: /org/freedesktop/DisplayManager/Seat0 DOTNET_BUNDLE_EXTRACT_BASE_DIR: /home/micke/.cache/dotnet_bundle_extract XDG_SESSION_CLASS: user USER: micke PAM_KWALLET5_LOGIN: /run/user/1000/kwallet5.socket SHLVL: 0 XDG_VTNR: 1 XDG_SESSION_ID: 1 XDG_RUNTIME_DIR: /run/user/1000 PATH: /usr/local/sbin:/usr/local/bin:/usr/bin:/home/micke/.dotnet/tools:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus MAIL: /var/spool/mail/micke OLDPWD: /home/micke XCURSOR_THEME: breeze_cursors XCURSOR_SIZE: 24 QT_WAYLAND_FORCE_DPI: 96 XKB_DEFAULT_LAYOUT: se MOZ_ENABLE_WAYLAND: 1 QT_AUTO_SCREEN_SCALE_FACTOR: 0 KDE_FULL_SESSION: true KDE_SESSION_VERSION: 5 KDE_SESSION_UID: 1000 KDE_APPLICATIONS_AS_SCOPE: 1 XDG_CONFIG_DIRS: /home/micke/.config/kdedefaults:/etc/xdg LC_NUMERIC: sv_SE.UTF-8 LC_TIME: sv_SE.UTF-8 LC_MONETARY: sv_SE.UTF-8 LC_MEASUREMENT: sv_SE.UTF-8 LC_COLLATE: sv_SE.UTF-8 PLASMA_USE_QT_SCALING: 1 GDK_SCALE: 1 GDK_DPI_SCALE: 1 SYSTEMD_EXEC_PID: 473 DISPLAY: :1 WAYLAND_DISPLAY: wayland-0 XAUTHORITY: /run/user/1000/xauth_AapznL GTK_RC_FILES: /etc/gtk/gtkrc:/home/micke/.gtkrc:/home/micke/.config/gtkrc GTK2_RC_FILES: /etc/gtk-2.0/gtkrc:/home/micke/.gtkrc-2.0:/home/micke/.config/gtkrc-2.0 SESSION_MANAGER: local/arch:@/tmp/.ICE-unix/573,unix/arch:/tmp/.ICE-unix/573

mickenorlen avatar Feb 15 '22 19:02 mickenorlen

QHotkey doesn't work on Wayland, see https://github.com/Skycoder42/QHotkey/issues/14.

pbek avatar Feb 15 '22 19:02 pbek

Ok thanks for info and a great application. I guess wayland needs more time.

mickenorlen avatar Feb 17 '22 19:02 mickenorlen

Thank you ;)

pbek avatar Feb 17 '22 20:02 pbek

@mickenorlen I ran into this same issue and was able to solve it by binding a global hotkey to the command-line interface. For KDE that involves going to Settings > Keyboard > Shortcuts and creating a global shortcut for the command QOwnNotes --action actionShow_Hide_application. There should be a similar interface in GNOME and other desktop environments.

So far this works well, but to make it easier / more discoverable for users I wonder if it might be possible to register "Show/Hide application" as one of the global shortcuts available for the program in the system menu?

Right now there are three such global actions associated with QOwnNotes in KDE Settings: New note (opens a new note), QOwnNotes (opens the application itself), and Show todo list (shows a todo list if available). See screenshot below to see what this looks like:

image

@pbek Are these shortcuts registered from within QOwnNotes, and if so could Show/Hide application be added to make it easier to restore this very useful functionality?

dohliam avatar Mar 07 '24 22:03 dohliam

Hah, looks like KDE Plasma finds the actions registered in the tray icon.

Btw. I spent over a week trying to make KDE Plasma 6 work with Wayland on all my systems with Nvidia graphic card. Hopeless... But at least I fixed https://github.com/pbek/QOwnNotes/issues/2976 while I was at it.

pbek avatar Mar 08 '24 05:03 pbek

@dohliam, what does the QOwnNotes: shortcut do? Maybe it already does show/hide.

pbek avatar Mar 08 '24 05:03 pbek

@dohliam, what does the QOwnNotes: shortcut do? Maybe it already does show/hide.

Nah, just tries to run QOwnNotes again...

pbek avatar Mar 08 '24 06:03 pbek

@dohliam, what does the QOwnNotes: shortcut do? Maybe it already does show/hide.

Yes, that was the first thing I tried! But as you discovered, it only opens the application.

Hah, looks like KDE Plasma finds the actions registered in the tray icon.

Thanks for the pointer -- it makes more sense now why these actions would be included and not others. Does this mean that all we would need to do to get Show/Hide as a globally-available action is to add a corresponding entry to this file for actionShow_Hide_application and the KDE shortcuts interface should then be able to pick it up automatically?

If so, I would be happy to submit a PR for this.

dohliam avatar Mar 08 '24 15:03 dohliam

Hah, the Desktop file, good find! Yes, sure, you can create a PR for adding the show/hide! Thank you.

pbek avatar Mar 09 '24 06:03 pbek

Although it will do the same as all the other desktop actions do, run QOwnNotes again with the parameter. So an attempt will be made to open a 2nd instance, like the QOwnNotes: shortcut.

pbek avatar Mar 09 '24 13:03 pbek

When the "single instance" mode is activated in QOwnNotes the current instance will get focus regardless of the action...

pbek avatar Mar 09 '24 13:03 pbek

Although it will do the same as all the other desktop actions do, run QOwnNotes again with the parameter. So an attempt will be made to open a 2nd instance, like the QOwnNotes: shortcut.

Yes, but the important thing is that it also hides the application if it is already in focus, so it acts as a toggle, which the QOwnNotes shortcut does not.

When the "single instance" mode is activated in QOwnNotes the current instance will get focus regardless of the action...

Well, that explains why this seems to work so far, since I have that option checked in settings. (Is this the default?)

It does raise an interesting question though regarding what the expected behaviour for the Show/Hide action would be when multiple instances are allowed. Only Show/hide the most recent instance? That seems like it might be complicated -- as a result I would only expect this to work with single-instance mode, whether on X or Wayland (or elsewhere).

dohliam avatar Mar 13 '24 23:03 dohliam

A desktop action will always run the command, which would spawn another process, won't it?

pbek avatar Mar 14 '24 09:03 pbek