KGlobalAccel can consume desktop file in order to set shortcuts for launching applications/invoking actions. To do so they must be in GenericDataLocation/kglobalaccel which typically is /usr/share/kglobalaccel or ~/.local/share/kglobalaccel. When such a component is disabled the current idea is that we write NoDisplay=true to the desktop file to mark it as disabled.
This has multiple shortcomings
- It doesn't work for desktop files that are not writable
- It abuses a well defined attribute and modifies .desktop files. Some applications link rather than copy their desktop files to the kglobalaccel directories. If we write the no display attribute to such a file we make the Application invisible.
- I couldn't find a place where the NoDisplay attribute is potentially removed if a file is readded again.
A solution could be
- Copy the file to writeable location if it is not writeable. This is straightforward.
- Use a custom attribute to store that a component is disabled. See D25088
- Remove the custom attribute when a component is added again. I think the constructor of KServiceActionComponent would a good place for that.
Alternatively we could store the disabled components in the configuration file (kglobalshortcutsrc) D28856. This avoids the issues entirely because we no longer need to mutate the desktop files. This is what I would also prefer for the future way forward for kglobalaccel.
Migration is potentially difficult because of the issues mentioned above. But it could have worked for files that were imported by the user and removed again. Can we just ignore it? Or do you have good ideas?