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]Text Cursor Context #127

Open
rp1231 opened this issue Apr 15, 2024 · 9 comments
Open

[Feature Request]Text Cursor Context #127

rp1231 opened this issue Apr 15, 2024 · 9 comments

Comments

@rp1231
Copy link

rp1231 commented Apr 15, 2024

I have set CapsLock{Right Half of my keyboard} as number pad keys.
But I would only like to have this mapping enabled when the text cursor is active as it is pretty much useless otherwise.
I would like the CapsLock to behave as the Control key when the normal mouse pointer is active.
It would be great if there was a feature which enabled you to set mappings for when the text cursor is active.
Thanks

@ristomatti
Copy link
Contributor

ristomatti commented Apr 15, 2024

IMHO this kind of feature should not be something for Keymapper to handle as a low level input device mapper. I'm not an expert on how this stuff works, but I would assume this would depend on the OS and possibly even application. Based on a quick search, it appears Windows has a mechanism to detect this but couldn't find a definite "yes" for Linux.

However, if you know a way to detect this in your specific use case, this should be possible with the recently introduced keymapperctl utility. You could then add virtual key e.g.:

TextInputMode = Virtual0

Then based on some external script, call keymapperctl --press TextInputMode when inputting text and keymapperctl --release TextInputMode afterwards.

Please share if you figure out how to do this on Linux. I too would find this useful for some purposes and something I was thinking about when I submitted #103 (ended up being implemented on #105).

@rp1231
Copy link
Author

rp1231 commented Apr 15, 2024

Hi, Thanks for the detailed explanation.
Unfortunately, I'm more of a poweruser rather than a programmer so it would be beyond my skillset to be able to implement this myself.
Though I am aware of a google chrome extension that has the ability to do this and run systemwide by the use of native messaging. Maybe that can help you for your purposes.
It doesn't support linux though.....

@rp1231
Copy link
Author

rp1231 commented Apr 21, 2024

It'll be great if it can be implemented just for windows, if linux is not possible.

@houmain
Copy link
Owner

houmain commented Apr 22, 2024

@rp1231 which browser extension are you referring to. Does it or any other application have this feature and does it work satisfactorily?

@ristomatti Thank you very much for your research! I also think that under Linux it is quite hopeless to make it work out of the box.

@rp1231
Copy link
Author

rp1231 commented Apr 23, 2024

@houmain the extension I was referring to is https://www.autocontrol.app/.
For eg. in this extension if you want to define the combination of Caps Lock + j to output 4 only when the text cursor is active,
It would look something like this:

Screenshot 2024-04-23 083944

@houmain
Copy link
Owner

houmain commented Apr 23, 2024

As far as I understand it, it does not work on Windows in general but only within the web browser, right?
I think one would have to create a browser extension, which informs keymapper about the the cursor state using native messaging and keymapperctl as ristomatti said.

@rp1231
Copy link
Author

rp1231 commented Apr 23, 2024

@houmain It does work on windows as well. The settings I showed in the screenshot enable you to do that. To use the extension, you need to install an extra exe as well which allows it to run system wide via native messaging.

@ristomatti
Copy link
Contributor

I believe Grammarly can also do this on Win/Mac/Android/iOS as well but not on Linux. But it's a commercial product with likely a big team working on it full time...

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

3 participants