Skip to content
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

Feature request: action accepting an arbitrary string handled by user-written code #797

Open
jtroo opened this issue Mar 3, 2024 · 3 comments
Labels
enhancement New feature or request gauging interest Looking for additional discussion and viewpoints

Comments

@jtroo
Copy link
Owner

jtroo commented Mar 3, 2024

Is your feature request related to a problem? Please describe.

Have a mechanism for people willing to write Rust code to easily add their own desired behaviours without needing to know too much about the keyberon library or the kanata processing loop.

Describe the solution you'd like.

Add a new list action (custom-behaviour "whatever string you want").

fn parse_action_list(ac: &[SExpr], s: &ParsedState) -> Result<&'static KanataAction> {

Add a new custom action CustomBehaviour(String)

pub enum CustomAction {

Add handling for press and release of CustomBehaviour. Define easy-to-find functions that accept the string defined in CustomBehaviour, which would be where users can add their code. Probably makes sense to put in a new file. Custom behaviour will be stringly typed 🧵.

match custom_event {

Add some documentation for how to interact with OS and read layout state.

Describe alternatives you've considered.

A user could certainly write their own code using llhook/evdev to do custom behaviours. But since kanata already has a lot of nice built-in behaviours that work mostly-fine out of the box, it might be nice to fork and extend kanata and add that little bit extra that's missing.

Though perhaps cmd is already a sufficient mechanism for this... ?

Additional context

N/A

@jtroo jtroo added the enhancement New feature or request label Mar 3, 2024
@jtroo jtroo changed the title Feature request: arbitrary string custom action Feature request: action accepting an arbitrary string handled by user-written code Mar 3, 2024
@jtroo
Copy link
Owner Author

jtroo commented Mar 3, 2024

This wouldn't be all that hard to implement, but I wonder if anyone would use it 😅

@jtroo jtroo added the gauging interest Looking for additional discussion and viewpoints label Mar 11, 2024
@jtroo
Copy link
Owner Author

jtroo commented Mar 13, 2024

This is an interesting potential integration too:
https://github.com/mattwparas/steel

@eugenesvk
Copy link
Contributor

eugenesvk commented Mar 19, 2024

By the way, what about making these shareable/plugin-like so you could use someone else's custom action?

Alternatively, is something less obscure than steel and more polyglot like, e.g., some kind of wasm custom action runtime feasible for an app like kanata?

Also

Though perhaps cmd is already a sufficient mechanism for this... ?

cmd flashes console windows when used with simple scripting commands with a gui app, which is rather disruptive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gauging interest Looking for additional discussion and viewpoints
Projects
None yet
Development

No branches or pull requests

2 participants