WIP: Implement hyprland-global-shortcuts-v1
#1165
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I made a simple client for testing: https://github.com/bbb651/global-shortcuts-test (and tested that it works correctly in hyprland)
I haven't tested it yet but it should work with the
GlobalShortcuts
portals with~/.config/xdg-desktop-portal/portals.conf
:Unresolved questions:
GlobalShortcuts
portal? Wlroots stopped adding protocols, ext seems likely to happen at some point, I think they'll be pretty similar (they'll both be following the portal pretty closely) so don't think it'll be hard to support both of them (and maybe remove the hyprland one at some point if clients aren't using it?). Gnome seems more problematic assuming it'll be DBus based, I think there's still value in having supporting a wayland protocol even if we support the Gnome one for layer-shell use cases so I don't think this should be a blocker.Action::TriggerGlobalShortcut
action that immediately presses and releases the shortcut, but this doesn't match the capabilities of the protocol (and theGlobalShortcuts
portal). Once we have release binds we could have separateAction::PressGlobalShortcut
&Action::ReleaseGlobalShortcut
actions, which is the most flexible but is a bit verbose. I like the idea of "hold actions" that are continuous instead of discrete and are bound to both an entire bind press and release, this works for other continuous actions like resizing and translating the view, but I'm not sure about a design that plays nice with both multiple actions per bind and release binds.HashMap<(String, String), HyprlandGlobalShortcut>
is a bit awkward in some places, the key reference becomes&(String, String)
and inniri msg global-shortcuts
I think it makes more sense to print them by app id. Hyprland seems to join them with:
and store and accepts them like that, this doesn't work correctly for app ids containing:
but they are technically invalid. Either way I still prefer separate arguments in the config and cli.Also currently ipc doesn't quite work (and I've just realized I've broken handling of duplicate shortcuts by creating the
HyprlandGlobalShortcutV1
object even when it errors later to try to workaround lifetimes..), the protocol implementation is a bit messy and clone strings a lot and CI fails (something is really wrong with my rust/cargo today, rust-analyzer repeatedly failed to run, it seemed to constantly be doing full rebuilds and it apparently didn't recompile ipc client...).