diff --git a/README.md b/README.md index 830bf079..df9eb36d 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,10 @@ modifiers and one-shot layer keys. It has the following methods: > useful for macros that need to fiddle with either modifier or layer state: if > one-shots are not active, they need not restore the original state. +### `.isPressed()` + +> Returns true if any one-shot key is still held. + ### `.isSticky(key)` > Returns if the key is currently sticky. diff --git a/src/Kaleidoscope/OneShot.h b/src/Kaleidoscope/OneShot.h index 0abfdd55..32751593 100644 --- a/src/Kaleidoscope/OneShot.h +++ b/src/Kaleidoscope/OneShot.h @@ -34,6 +34,9 @@ class OneShot : public kaleidoscope::Plugin { return (key.raw >= kaleidoscope::ranges::OS_FIRST && key.raw <= kaleidoscope::ranges::OS_LAST); } static bool isActive(void); + static bool isPressed() { + return !!pressed_state_.all; + } static bool isActive(Key key); static bool isSticky(Key key); static void cancel(bool with_stickies);