Draft
Conversation
Add global_shortcuts module to config
Implement Display for Key related structs. Enables runtime comparison/(de)serialization of Key and incoming dbus requests
Added tests for Display, idempotence must be maintained or communication between dbus will result in failed shortcut registration/activation
Emulate gnome's settings provider using config file as source of truth, rather than popups/menus
Enable conditional inhibiting of a global shortcut using `inhibit` property, defaults to true
Creates `Shell` interface, serves as the interface between niri and the GlobalShortcuts portal interface Stores state of Key -> Action (u32) bindings, emits (De)activation signals on relevant keypresses and intercepts where applicable
Rewrote some leftover badly structured code Rename `inhibit` to `intercept` for better insight into its purpose
75c8b0f to
24dd808
Compare
Refactor `gen_action` and replace with the obvious iterator it should have been.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This implements GlobalShortcuts via xdg-desktop-portal-gnome (as per discussion on #1165 and limited discussion #2775)
Two dbus interfaces are implemented
org.gnome.Settings.GlobalShortcutsProviderandorg.gnome.Shell. The former is requested by the gnome portal to validate shortcut requests and return the results to gnome portal (which it uses to callGrabAccelerators).The latter is the interface to grab, ungrab and emit (de)activation signals for shortcuts.
I haven't added any wiki info on the
global-shortcutconfig yet, if the current setup I have looks good to everyone then I'll add the wiki page to document it.The limited number of programs I have found that implement GlobalShortcuts seem like they're all just doing their own thing, which makes config require some flexibility.
For example,
preferred-trigger, leaving thepreferred-triggerentry empty.preferred-trigger.shortcut-idas well.Niri has the final say on what a binding is so the mismatch between preferred-trigger and what is returned to the application is moot. (e.g. an application can request
Ctrl+Shift+Mand getMod+Yreturned to it, it only truly needs theactionid returned alongside it)Shortcuts can optionally disable inhibiting the keypresses.
A single binding can match multiple shortcuts if the
matchargument is set up as such. (e.g.app-id { match "(ghostty)|(discord)"; }Currently it doesn't support mouse bindings but provided this PR is on the right track I believe I can add them fairly trivially.
Let me know thoughts and opinions and I'll try to get this shaped up.