https://bugs.kde.org/show_bug.cgi?id=498575
Bug ID: 498575 Summary: GlobalShortcuts BindShortcuts issues Classification: Plasma Product: xdg-desktop-portal-kde Version: 6.2.5 Platform: Arch Linux OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: plasma-b...@kde.org Reporter: kylie...@gmail.com CC: aleix...@kde.org Target Milestone: --- SUMMARY A few related issues calling org.freedesktop.portal.GlobalShortcuts.BindShortcuts: 1. Registering a new shortcut with a conflicting `preferred_trigger` will return that trigger in `trigger_description` as if it was bound and works for that new shortcut. - Also happens if the conflicting `preferred_trigger` was made in the same `BindShortcuts` call, first shortcut in the array will *actually* have the bind applied 2. Re-registering an existing shortcut that was originally registered without a preferred_trigger will turn any Custom shortcuts into Default shortcuts - System settings needs to be closed for this effect. Needs to be the _first_ BindShortcuts call of the Session (which brings me to my next point) 3. Does not conform to the spec: - > "An application can only attempt bind shortcuts of a session once." https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.GlobalShortcuts.html#org-freedesktop-portal-globalshortcuts-bindshortcuts 4. The `description` of the `shortcuts` array has no upper limit meaning apps can create HUGE entries that crash systemsettings on trying to load the config for the entry - Users can still delete the entry just fine. STEPS TO REPRODUCE Create a valid GlobalShortcuts session and call BindShortcuts with: for 1. ``` shortcuts = [( "shortcut1", {"description": "Demo Shortcut 1", "preferred_trigger": "CTRL+1"}), ( "shortcut2", {"description": "Demo Shortcut 2", "preferred_trigger": "CTRL+1" }) ``` for 2. ``` shortcuts = [( "shortcut1", {"description": "Demo Shortcut 1"}) ``` 2a. Add some custom shortcuts binds to the shortcut with the shortcuts KCM then close SystemSettings 2b. close then create a new GlobalShortcuts session and call BindShortcuts with the above shortcuts array. for 3. Do any of the above shortcuts arrays but continue calling BindShortcuts with it. for 4. Do any of the above shortcuts arrays but fill the description with an absurd amount of characters like ``` insane_string = 'a' * 20 * 1024 * 1024 ``` OBSERVED RESULT for 1. You will see both shortcuts have Ctrl+1 returned in their respective `trigger_description`s but only shortcut1 will have Activated and Deactivated Signals get triggered on a key press. - Until A `ShortcutsChanged` signal that effects the misreporting shortcut or A new dbus session is used, `ListShortcuts` calls and `ShortcutsChanged` signals will continue to return this wrong trigger_description for the misbehaving shortcut. for 2. Viewing the shortcut's binds in the keybinds Settings KCM will show the Custom shortcuts you previously bound as Default shortcuts. They are only disableable and not removable. for 3. After the first call they are not rejected. for 4. Calling BindShortcuts with this shortcuts array will open systemsettings and immediately hang/crash. Later attempts to edit the shortcuts of the entry will crash. Can only fully delete the entry EXPECTED RESULT for 1. The conflicted shortcut will not have wrong info returned in `trigger_description` for 2. On shortcuts with no preferred_trigger user set custom shortcuts are not turned into default shortcuts on rebind for 3. After the first call BindShortcuts attempts are rejected. for 4. Concatenate what is displayed in the shortcuts KCM or reject bind attempts with huge description elements SOFTWARE/OS VERSIONS KDE Plasma Version: 6.2.5 KDE Frameworks Version: 6.10.0 Qt Version: 6.8.1 Graphics Platform: Wayland ADDITIONAL INFORMATION I used a custom python & gtk demo app with a .desktop for testing purposes. LMK if I should share it for testing -- You are receiving this mail because: You are watching all bug changes.