You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by kdwk September 28, 2023
The current way of adding actions and keyboard shortcuts for them is complicated and verbose. First, outside of the component one needs to declare an action group and action with macros, then in the fn init() of the component I need to get the main app, declare an action group (again), actually define the action, add the action to the action group, and attach the action group to a window.
Not only is this very troublesome, but it goes against the Relm model of handling inputs with the Input enum in fn update(), since actions bypass this mechanism. This also duplicates lots of code because many actions with keyboard shortcuts are also triggered with e.g. buttons in the UI, so the code needs to exist twice when one defines the action and in fn update().
Instead of the status quo, I would love to see actions being integrated with the Input enum or fn init(). Ideally, one should not need to declare any action or action group separately. Instead, either in the Input enum or fn update() one can attach the keyboard shortcut to the inputs.
Discussed in https://github.com/orgs/Relm4/discussions/544
Originally posted by kdwk September 28, 2023
The current way of adding actions and keyboard shortcuts for them is complicated and verbose. First, outside of the component one needs to declare an action group and action with macros, then in the fn init() of the component I need to get the main app, declare an action group (again), actually define the action, add the action to the action group, and attach the action group to a window.
Not only is this very troublesome, but it goes against the Relm model of handling inputs with the Input enum in fn update(), since actions bypass this mechanism. This also duplicates lots of code because many actions with keyboard shortcuts are also triggered with e.g. buttons in the UI, so the code needs to exist twice when one defines the action and in fn update().
Instead of the status quo, I would love to see actions being integrated with the Input enum or fn init(). Ideally, one should not need to declare any action or action group separately. Instead, either in the Input enum or fn update() one can attach the keyboard shortcut to the inputs.
e.g.
and Relm4 would automatically do the setting up of actions and actiongroups and attach the keyboard shortcut to the root of the component.
The text was updated successfully, but these errors were encountered: