From 098320ce8c666d91770e2e19bd295607e3e7d06f Mon Sep 17 00:00:00 2001 From: Johannes Bensmann Date: Tue, 18 Oct 2022 21:47:40 +0200 Subject: [PATCH] allow hold key when another key is pressed --- taphold.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/taphold.go b/taphold.go index 4957a95..e5ad5b5 100644 --- a/taphold.go +++ b/taphold.go @@ -71,8 +71,7 @@ func (t *TapHoldHandler) handleKey(event KeyboardEvent) { if event.isPress { // tapHold key pressed? if binding, ok := currentLayer.Bindings[event.code].(TapHoldBinding); ok { - // activate holdBack only when no other key is pressed - if !t.isAnyKeyPressed() && !t.isHoldBack { + if !t.isHoldBack { log.Debugf("Activating holdBack") t.isHoldBack = true t.tapHoldEvent = &event @@ -152,12 +151,6 @@ func (t *TapHoldHandler) IsKeyPressed(code uint16) bool { return ok && pr } -func (t *TapHoldHandler) isAnyKeyPressed() bool { - t.isPressedLock.RLock() - defer t.isPressedLock.RUnlock() - return len(t.isPressed) > 0 -} - func (t *TapHoldHandler) setKeyPressed(code uint16, pressed bool) { t.isPressedLock.Lock() defer t.isPressedLock.Unlock()