Bug 474741 - Binding Global Shortcuts through the Portal fails with Python
Summary: Binding Global Shortcuts through the Portal fails with Python
Status: RESOLVED FIXED
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (show other bugs)
Version: 5.27.8
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-20 18:39 UTC by winblocker
Modified: 2024-03-10 10:23 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description winblocker 2023-09-20 18:39:02 UTC
SUMMARY
I was trying to make an example application using python that utilizes the Global Shortcuts Portal. 
The code for it is here: https://gist.github.com/Aviana/a3a0368172e326d6ccc57cb254c1e569
When watching the bus with dbus-monitor it seems as if i am sending the correct signals. However when running this snippet the system settings open but my app is not showing in the list.
I have tried to the best of my abilities to make this work but i am simply stuck.


STEPS TO REPRODUCE
1. Run the provided snippet
2. Watch the KDE settings open

OBSERVED RESULT
The registered app "mytest" is not listed in the settings.

EXPECTED RESULT
There should be an entry along the lines of "mytest" with 2 configurable key bindings.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.6.0-rc1-1-mainline (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 5950X 16-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 6900 XT
Manufacturer: ASUS
Comment 1 Lindsay Roberts 2024-02-24 10:41:22 UTC
Hey, found the same issue trying to get my own app to work via this protocol, and fixed xdg-desktop-portal-kde after some debugging and digging. Just found your issue which is likely to be the same problem.

Have a merge request open to fix it at https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/274 . It also contains information on why support ended up broken.

Another merge request in the test code if you'd like to see the change necessary to have client code work relative to the examples coded against the draft protocol: https://invent.kde.org/libraries/xdg-portal-test-kde/-/merge_requests/25
Comment 2 Lindsay Roberts 2024-03-06 18:07:30 UTC
Git commit a748343ee8a8cdfaeaa4a40544ce41a5e3b56e97 by Lindsay Roberts, on behalf of Lindsay Roberts.
Committed on 06/03/2024 at 18:03.
Pushed by roberts into branch 'master'.

GlobalShortcuts: Set shortcuts in BindShortcuts

The protocol changed in
https://github.com/flatpak/xdg-desktop-portal/commit/8cb5b6d997108443ecc26152c95bbca8c8c58fc3
to accept shortcuts in BindShortcuts instead of CreateSession.
xdg-desktop-portal no longer forwards shortcuts from CreateSession so
before this change, no shortcuts could be created.

M  +1    -4    src/globalshortcuts.cpp
M  +1    -10   src/session.cpp
M  +1    -1    src/session.h

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/a748343ee8a8cdfaeaa4a40544ce41a5e3b56e97
Comment 3 Nicolas Fella 2024-03-10 10:23:49 UTC
Git commit 726d22c71aac0f820773ce5bb3ab91f8ffc77e1b by Nicolas Fella, on behalf of Lindsay Roberts.
Committed on 07/03/2024 at 18:57.
Pushed by nicolasfella into branch 'Plasma/6.0'.

GlobalShortcuts: Set shortcuts in BindShortcuts

The protocol changed in
https://github.com/flatpak/xdg-desktop-portal/commit/8cb5b6d997108443ecc26152c95bbca8c8c58fc3
to accept shortcuts in BindShortcuts instead of CreateSession.
xdg-desktop-portal no longer forwards shortcuts from CreateSession so
before this change, no shortcuts could be created.
(cherry picked from commit a748343ee8a8cdfaeaa4a40544ce41a5e3b56e97)

M  +1    -4    src/globalshortcuts.cpp
M  +1    -10   src/session.cpp
M  +1    -1    src/session.h

https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/726d22c71aac0f820773ce5bb3ab91f8ffc77e1b