Bug 487941 - Editing custom keyboard shortcuts changes the name shown in the list, but not the actual command until the kglobalaccel daemon is restarted
Summary: Editing custom keyboard shortcuts changes the name shown in the list, but not...
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keys (other bugs)
Version First Reported In: 6.0.4
Platform: openSUSE Linux
: HI major
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 489529 497726 500856 511579 511599 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-02 22:44 UTC by Pavel Urusov
Modified: 2025-11-19 17:02 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
screenshot that shows that the displayed name and the actual command do not match (186.20 KB, image/png)
2024-06-02 22:44 UTC, Pavel Urusov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Urusov 2024-06-02 22:44:03 UTC
Created attachment 170077 [details]
screenshot that shows that the displayed name and the actual command do not match

SUMMARY
If I create a keyboard shortcut with a wrong command and later edit it with the edit button, the displayed command changes in the list but the actual command that gets executed stays the same as the initial command.

STEPS TO REPRODUCE
1. Go to System Settings -> Keyboard -> Shortcuts
2. Click "Add New" and select "Command or Script..." from the drop-down menu
3. Now edit the newly created shortcut to change the command.

OBSERVED RESULT

The name displayed in the list of shortcuts changes, but the actual command which gets executed remains the same as the initial command. 

Please see the attached screenshot: you can see that the shortcut is labeled "kwin-tile 3" in the list while the actual command on the right says "kwin-tile 4"

EXPECTED RESULT

The command that gets executed changes when the user edits the shortcut.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20240524
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.0
Kernel Version: 6.9.1-1-default (64-bit)
Graphics Platform: Wayland
Comment 1 Nate Graham 2024-06-12 16:33:00 UTC
Can reproduce.
Comment 2 Nate Graham 2024-06-13 21:43:02 UTC
So the file on disk gets changed correctly, but after doing so, the code doesn't reload the action with KGlobalAccel. As a result you have to restart either KGlobalAcceld (on X11) or kwin_wayland (on Wayland) for the change to take effect.
Comment 3 Bharadwaj Raju 2024-06-29 20:14:29 UTC
kglobalacceld loads `KService`s for each .desktop file. I experimented with making every service component reload its service whenever KSycoca signalled a database change, and this partially solves it. With this change, whenever you change the command, the immediate next press of the shortcut uses the old command but after that it switches over to the new one. Don't know why that's happening yet, will have to investigate.
Comment 4 cwo 2024-07-01 09:47:05 UTC
*** Bug 489529 has been marked as a duplicate of this bug. ***
Comment 5 fanzhuyifan 2024-08-12 02:59:46 UTC
(In reply to Bharadwaj Raju from comment #3)
> kglobalacceld loads `KService`s for each .desktop file. I experimented with
> making every service component reload its service whenever KSycoca signalled
> a database change, and this partially solves it. With this change, whenever
> you change the command, the immediate next press of the shortcut uses the
> old command but after that it switches over to the new one. Don't know why
> that's happening yet, will have to investigate.

Passively waiting for database change signals from KSycoca might not be a great idea, as testing on my end, this often only triggers 10s of seconds after the edit finished. Maybe the kcm could try deleting and recreating the component?
Comment 6 fanzhuyifan 2025-01-12 00:54:09 UTC
*** Bug 497726 has been marked as a duplicate of this bug. ***
Comment 7 Nicolas Fella 2025-02-28 11:29:19 UTC
*** Bug 500856 has been marked as a duplicate of this bug. ***
Comment 8 Nicolas Fella 2025-11-06 12:45:44 UTC
*** Bug 511599 has been marked as a duplicate of this bug. ***
Comment 9 Nicolas Fella 2025-11-06 12:46:02 UTC
*** Bug 511579 has been marked as a duplicate of this bug. ***
Comment 10 dmatteo002 2025-11-19 17:02:25 UTC
As workaround I also change the key combination, then click apply and finally change the key combination back to the previous one (and click apply again). To see the result, just click on some other shortcut and then back to the custom shortcut page.