-
Notifications
You must be signed in to change notification settings - Fork 19
feat(cardwire-gui): add XDG global shortcuts and desktop actions #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xufosa
wants to merge
1
commit into
OpenGamingCollective:main
Choose a base branch
from
xufosa:feat/xdg-shortcuts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,5 +47,6 @@ pub enum Message { | |
| OpenUrl(String), | ||
| ClearError, | ||
| ClearInfo, | ||
| GlobalShortcutTriggered(String), | ||
| None, | ||
| } | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: OpenGamingCollective/cardwire
Length of output: 7084
🌐 Web query:
ashpd 0.13.13 GlobalShortcuts bind_shortcuts Request response shortcuts docs.rs💡 Result:
<search_synthesis>
In ashpd version 0.13.13, the bind_shortcuts method is part of the GlobalShortcuts interface, which is located in the ashpd::desktop::global_shortcuts module and requires the global_shortcuts crate feature to be enabled [1][2][3]. The bind_shortcuts method is defined as follows [4]: pub async fn bind_shortcuts( &self, session: &Session<Self>, shortcuts: &[NewShortcut], identifier: Option<&WindowIdentifier>, options: BindShortcutsOptions,) -> Result<Request<BindShortcuts>, Error> Key components: 1. NewShortcut: Used to define the shortcuts being requested, constructed via NewShortcut::new(id, description) and optionally configured with.preferred_trigger [2][5]. 2. BindShortcutsOptions: A struct for specifying options, including a handle_token [4][6]. 3. Response: The method returns a Request<BindShortcuts> [4]. The BindShortcuts struct represents the response received from the portal, providing a.shortcuts method that returns a slice of the successfully bound Shortcut objects [4][1][2]. This API maps to the org.freedesktop.portal.GlobalShortcuts.BindShortcuts D-Bus interface [4][2].
</search_synthesis>
<source_evidence>
Citations:
🌐 Web query:
ashpd 0.13.13 Request response method portal cancellation error docs.rs💡 Result:
<search_synthesis>
In ashpd 0.13.13, portal interaction management and cancellation are handled through the Request object, which is returned when calling a portal method [1][2]. When a portal interaction occurs, the application receives a Request object. To retrieve the result, the application calls the Request::response method, which returns a Result<T, Error> [1][3]. This Error type can encapsulate various issues, including those related to the portal request&
#39;s outcome [4]. Regarding cancellation and error handling: 1. Cancellation: If the user cancels the interaction, the Response signal typically results in a ResponseError::Cancelled variant [3][5]. 2. Manual Cancellation: Applications can manually abort an ongoing interaction by calling the Request::close method [1][3]. When this method is used, the portal request is closed, and a "Response" signal will not be emitted, effectively ending the interaction without triggering the standard response handling [1][3]. 3. Error Representation: The library maps portal response outcomes to its own internal types. If a request does not succeed, it often surfaces through the ResponseError enum, which contains Cancelled and Other variants [3][5]. Furthermore, internal portal errors during the DBus call are handled via the PortalError type (e.g., PortalError::Cancelled) [4]. Recent updates have improved the mapping between these backend errors and standard portal response codes to ensure consistent reporting, particularly distinguishing between user cancellation and other types of failures [6].</search_synthesis>
<source_evidence>
Citations:
Handle the portal bind response.
bind_shortcutsreturnsResult<Request<BindShortcuts>, Error>. The current code drops theRequest, so it does not observe cancellation or inspect theBindShortcuts::shortcuts()list. If the portal binds no shortcuts, the GUI still waits for activation signals without warning.Proposed fix
🤖 Prompt for AI Agents