Bug 492992 - GlobalShortcuts: Does not reuse previously created shortcuts in subsequent runs
Summary: GlobalShortcuts: Does not reuse previously created shortcuts in subsequent runs
Status: RESOLVED FIXED
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (show other bugs)
Version: 6.1.4
Platform: NixOS Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-11 21:29 UTC by tuxinal
Modified: 2025-01-11 13:15 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0
Sentry Crash Report:


Attachments
First run. shortcuts added normally. (89.48 KB, image/png)
2024-09-11 21:59 UTC, tuxinal
Details
Subsequent runs. doesn't reuse shortcuts from the first run. instead creates a new set of shortcuts which don't work due to conflicts with the shortcuts from the last run. (109.88 KB, image/png)
2024-09-11 22:00 UTC, tuxinal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tuxinal 2024-09-11 21:29:56 UTC
SUMMARY
(this is technically two issues but they are intertwined)
during the shortcut creation process a new section is created in the shortcuts KCM page and it's name consists of the calling app_id and the current session token (issue number one leading to issue number two:) this will cause an app to not reuse the shortcuts from last session since it's session token is different on each run. this means every time an app using GlobalShortcuts initializes it will create a new set of shortcuts. these shortcuts will always be in conflict with the old shortcuts from previous runs unless the user manually removes them.  

STEPS TO REPRODUCE
1. create new shortcuts using the GlobalShortcuts api (example program: https://github.com/tuxinal/kde_xdp_bugreport. i believe xdg-portal-test-kde also provides GlobalShortcuts) 
2. run multiple times

OBSERVED RESULT
multiple sets of conflicting shortcuts are created on each run

EXPECTED RESULT
reuses the shortcuts from previous runs

SOFTWARE/OS VERSIONS

Operating System: NixOS 24.05
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.2
Kernel Version: 6.6.49 (64-bit)
Graphics Platform: Wayland
xdg-desktop-portal-kde: 6.1.4
Comment 1 tuxinal 2024-09-11 21:59:01 UTC
Created attachment 173566 [details]
First run. shortcuts added normally.
Comment 2 tuxinal 2024-09-11 22:00:07 UTC
Created attachment 173567 [details]
Subsequent runs. doesn't reuse shortcuts from the first run. instead creates a new set of shortcuts which don't work due to conflicts with the shortcuts from the last run.
Comment 3 Nicolas Fella 2025-01-11 13:12:52 UTC
Git commit 6880df9550cd89e805a9402b9d781b5e80a435c0 by Nicolas Fella, on behalf of Tuxinal Tuxinal.
Committed on 11/01/2025 at 13:12.
Pushed by nicolasfella into branch 'master'.

Make the component name for GlobalShortcuts only consist of appId if provided

Use desktop entry name for display name if exists

Co-authored-by: Kylie C <kyliepc@proton.me>
Co-authored-by: Nicolas Fella <nicolas.fella@gmx.de>

M  +3    -1    src/session.cpp
M  +1    -1    src/session.h

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/6880df9550cd89e805a9402b9d781b5e80a435c0
Comment 4 Nicolas Fella 2025-01-11 13:15:22 UTC
Git commit 31e124bb8451a58f43374881800639fd2b430aac by Nicolas Fella, on behalf of Tuxinal Tuxinal.
Committed on 11/01/2025 at 13:15.
Pushed by nicolasfella into branch 'Plasma/6.3'.

Make the component name for GlobalShortcuts only consist of appId if provided

Use desktop entry name for display name if exists

Co-authored-by: Kylie C <kyliepc@proton.me>
Co-authored-by: Nicolas Fella <nicolas.fella@gmx.de>
(cherry picked from commit 6880df9550cd89e805a9402b9d781b5e80a435c0)

M  +3    -1    src/session.cpp
M  +1    -1    src/session.h

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/31e124bb8451a58f43374881800639fd2b430aac