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

Custom prefix in addition to backslash #25

Open
eugenesvk opened this issue Nov 21, 2023 · 4 comments
Open

Custom prefix in addition to backslash #25

eugenesvk opened this issue Nov 21, 2023 · 4 comments

Comments

@eugenesvk
Copy link
Contributor

eugenesvk commented Nov 21, 2023

Since \ is a very inconvenient pinky key, is it possible to have user-customizable prefix like ,, (double tap that is not used elsewhere)

Alternatively, is it possible to trigger this IME with a key combo? This way you could use some other app to bind ,, to start the sequence

@knrafto
Copy link
Owner

knrafto commented Nov 21, 2023

A custom prefix seems doable. It's a little tricky though if it's not a single key. For example, what if you're in the middle of typing a latex command and you write foo, and then type another ,, should the IME delete the first comma and enter the replacement for \foo and then start another command? What if your prefix is ,,, you type foo,,, then backspace, then ,,?

I'm not sure about a key combo though, I think the OS only sends us individual keydown events.

@knrafto knrafto changed the title Custom prefix in additon to backslash Custom prefix instead of backslash Nov 21, 2023
@eugenesvk
Copy link
Contributor Author

Am I correct that multiple prefixes are not feasible since you've updated the title? I thought you could have the old \ as is and then add an experimental one to see which one is better to eventually arrive at the best (or always keep both)

For example, what if you're in the middle of typing a latex command and you write foo, and then type another ,, should the IME delete the first comma and enter the replacement for \foo and then start another command?

I thought it'd work just like \ where you don't delete the trigger itself, but replace it if a match is found, so the IME would enter the replacement for the first ,,foo (or \foo if both triggers are allowed), then enter a new IME mode for the second ,,bar just like \inf\in currently inserts and enters a new mode with \in

What if your prefix is ,,, you type foo,,, then backspace, then ,,?

Only uninterrupted taps should be a trigger

I'm not sure about a key combo though, I think the OS only sends us individual keydown events.

One workaround: if you add an artificial key like F24 as your second trigger, then you could map whatever combo in Karabiner to this trigger and have a clean entry without \! (another benefit of having multiple triggers)

@knrafto
Copy link
Owner

knrafto commented Nov 22, 2023

Sorry, I misunderstood, I'll change the title back.

I think I spoke too soon about key combos. My memory is hazy but it looks like we explicitly filter out everything but keydown events. I don't remember what these other events look like though.

Overall this feature request seems a bit tricky to get right. As workaround, would it work to configure Karabiner to send \ for your combo?

@knrafto knrafto changed the title Custom prefix instead of backslash Custom prefix in addition to backslash Nov 22, 2023
@eugenesvk
Copy link
Contributor Author

Unfortunately Karabiner Elements isn't capable enough to do double taps, but otherwise I've tested and it does work to enable IME if you bind some other key combo to output the \ key

pqrs-org/Karabiner-Elements#3430

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants