pop-os / xdg-desktop-portal-cosmic

GNU General Public License v3.0
35 stars 30 forks source link

feature request: GlobalShortcuts portal #4

Open jokeyrhyme opened 1 year ago

jokeyrhyme commented 1 year ago

Howdie, thanks so much for sharing your work here

I noticed that there has been work done on specifying a portal for GlobalShortcuts: https://flatpak.github.io/xdg-desktop-portal/#gdbus-org.freedesktop.portal.GlobalShortcuts

This would be useful for communications apps that have push-to-talk functionality, as well as various other use cases

Do you know if this is likely to be on the roadmap? Or is it considered out-of-scope or otherwise not part of your project goals/vision?

Note that KDE does seem to advertise support for this portal: https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/blob/master/data/kde.portal#L3

To clarify: I'm grateful for the work shared here, and am curious about whether this work is already planned or if you'd accept a PR that implements this, I do not expect a timeline or ETA :people_hugging:

Drakulix commented 1 year ago

This might not be part of the first alpha, but we have been waiting for this portal to arrive. We plan to make this a central part of our key-bindings and key-customization story, so support is definitely on the roadmap rather sooner than later.

It is not yet clear, how the key bindings would be communicated back to the compositor (likely through some non-existent private wayland protocol), but if you want to contribute a implementation of the frontend to the portal, that would be very welcome.

jokeyrhyme commented 1 year ago

Yeah, the trick is allowing xdg-desktop-portal-cosmic to communicate with cosmic-comp in order to set the keyboard shortcut

hyprland did implement a custom wayland protocol to allow xdg-desktop-portal-hyprland to talk to hyprland for this purpose: https://github.com/hyprwm/hyprland-protocols/blob/main/protocols/hyprland-global-shortcuts-v1.xml

cosmic-comp could also expose a DBus API, or have a separate UNIX socket, or we could adopt hyprland's wayland protocol, or come up with our own wayland protocol

Or (and I doubt this is the approach we'd take), xdg-desktop-portal-cosmic could directly modify cosmic-comp's config.ron, cosmic-comp could reload it after receiving an fs inotify or a SIGHUP or something

I did propose a general purpose solution that relies on DBus and shell scripts to make this work ( https://github.com/emersion/xdg-desktop-portal-wlr/issues/240#issuecomment-1546811352 ) but that wouldn't be necessary here seeing as xdg-desktop-portal-cosmic only has to support cosmic-comp (and vice versa)

jokeyrhyme commented 7 months ago

GlobalShortcuts portal briefly mentioned here: https://github.com/pop-os/cosmic-comp/pull/283

jokeyrhyme commented 7 months ago

It is not yet clear, how the key bindings would be communicated back to the compositor (likely through some non-existent private wayland protocol)

Could/should cosmic-comp subscribe to changes in cosmic-config the same way other components do, and have that be the way it learns when keyboard shortcuts have changed?

jokeyrhyme commented 7 months ago

Ah, I'm just realising that keybindings set via GlobalShortcuts are likely session-only, and probably shouldn't be persisted to disk, so cosmic-config would need a separate session-only concept if it were to be used for communicating GlobalShortcuts with other components

Drakulix commented 7 months ago

Right so there are multiple open questions on this subject.

Lets first define some names:

Default Shortcuts are set by cosmic-comp and should likely include most of whats defined in the default-config file today. They could be overridden/replaced by static/dynamic shortcuts at runtime.

One set of open questions regards the "Static Shortcuts". They should be managed via cosmic-config for easy persistence and access for all components.

Open questions:

The other set of questions concerns the dynamic shortcuts: