Skip to content

Commit

Permalink
🐛 #314 Fix small regression
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKai77 committed May 24, 2024
1 parent a0f88c8 commit 5c03850
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Loop/Managers/LoopManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,15 @@ class LoopManager: ObservableObject {
processModifiers(event)

let triggerKey = Defaults[.triggerKey]
let wasKeyDown = (event.type == .keyDown || currentlyPressedModifiers.count > previousModifiers.count)
let wasKeyDown = event.type == .keyDown || currentlyPressedModifiers.count > previousModifiers.count

if wasKeyDown, triggerKey.isSubset(of: currentlyPressedModifiers) {
guard !isLoopActive else {
guard
!isLoopActive,

// This makes sure that the amount of keys being pressed is not more than the actual trigger key
currentlyPressedModifiers.count <= triggerKey.count
else {
return
}

Expand All @@ -323,9 +328,7 @@ class LoopManager: ObservableObject {
}
lastTriggerKeyClick = .now
} else {
if isLoopActive {
closeLoop()
}
closeLoop()
}
}

Expand Down Expand Up @@ -382,6 +385,8 @@ class LoopManager: ObservableObject {
}

private func closeLoop(forceClose: Bool = false) {
guard isLoopActive == true else { return }

triggerDelayTimer = nil
closeWindows()

Expand Down

0 comments on commit 5c03850

Please sign in to comment.