17
submitted 1 year ago by [email protected] to c/[email protected]

I seeked into the API in order to write a plugin for myself. In order to aid my workflow I need to listen to two keystrokes closely followed.

Apparently there are only hacks available. I want to fire-and-forget about my plugin as long as the API to command firefox stays consistent.

I did not attempt to write any code (and any JS code, honestly that is) yet. Simply because I did not get that requirement addressed by the official API /& documentation.

Recompiling firefox would be the least favorable option; But I would still be hooked if it would enable me to observe keystrokes on my own.

As an practical example: Pressing Shift two times in sequence and within 100 ms should enable me to eat the event.

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 2 points 1 year ago

If you just need to intercept the keypresses in webpages then you can inject a content script and handle these. However there is no way with the new WebExtensions API to intercept browser chrome events.

Additionally there is no way to delay events. So if you want to suppress both shift presses you will struggle to do that. If you are ok to let the first one go through suppressing the second one is trivial.

[-] [email protected] 1 points 1 year ago

Thanks, @[email protected]. That sums up my options.

this post was submitted on 10 Jun 2024
17 points (94.7% liked)

Firefox

20317 readers
259 users here now

/c/firefox

A place to discuss the news and latest developments on the open-source browser Firefox.


Rules

1. Adhere to the instance rules

2. Be kind to one another

3. Communicate in a civil manner


Reporting

If you would like to bring an issue to the moderators attention, please use the "Create Report" feature on the offending comment or post and it will be reviewed as time allows.


founded 5 years ago
MODERATORS