Implement OneShot.isPressed()

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent 26bfce0b77
commit c791e8163c

@ -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 > 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. > 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)` ### `.isSticky(key)`
> Returns if the key is currently sticky. > Returns if the key is currently sticky.

@ -34,6 +34,9 @@ class OneShot : public kaleidoscope::Plugin {
return (key.raw >= kaleidoscope::ranges::OS_FIRST && key.raw <= kaleidoscope::ranges::OS_LAST); return (key.raw >= kaleidoscope::ranges::OS_FIRST && key.raw <= kaleidoscope::ranges::OS_LAST);
} }
static bool isActive(void); static bool isActive(void);
static bool isPressed() {
return !!pressed_state_.all;
}
static bool isActive(Key key); static bool isActive(Key key);
static bool isSticky(Key key); static bool isSticky(Key key);
static void cancel(bool with_stickies); static void cancel(bool with_stickies);

Loading…
Cancel
Save