Skip to content

Commit

Permalink
allow hold key when another key is pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Bensmann committed Oct 18, 2022
1 parent b58ce86 commit 098320c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions taphold.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 098320c

Please sign in to comment.