Sublime Forum

Detect key events

#1

Hello everyone!

I have been searching for a way to detect when a key is pressed/released. I would like to develop a plugin that use the capslock key but it dosn’t seem possible to detect the state of the key.

My idea for the plugin is the following:
When you press (and hold down) the capslock key you enter a simple search mode.
When in this mode you can then type a string to search after, much like the normal search function already in Sublime.
After that you release the capslock key and you exit the simple search mode.

If you now click capslock again (both push/release) then the plugin will perform an incremental search using the same string as entered last time it was used.

If you use shift as a modifier it will do the same thing (for both cases) only it will search backwards instead.

This plugin is meant to be used to navigate text quickly, and it wont show any dialog boxes or input fields and such.

Does anyone know if it is even possible to develop such a plugin for Sublime?

/Hasofanten

0 Likes

Add key to selection if modifier is down?
#2

I believe this is impossible using Sublime Text’s API. You might be able to use AutoHotKey or something, though.

0 Likes

#3

Ok, thanks for your answer.

0 Likes