Skip to content

Commit

Permalink
🔀 Merge pull request #192 from MrKai77/188-disable-mouse-to-loop
Browse files Browse the repository at this point in the history
✨ #188 Ability to disable cursor interaction
  • Loading branch information
MrKai77 authored Jan 25, 2024
2 parents 020dc02 + 5eae73d commit 4f0865a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Loop/Extensions/Defaults+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extension Defaults.Keys {
static let radialMenuCornerRadius = Key<CGFloat>("radialMenuCornerRadius", default: 50)
static let radialMenuThickness = Key<CGFloat>("radialMenuThickness", default: 22)
static let hideUntilDirectionIsChosen = Key<Bool>("hideUntilDirectionIsChosen", default: false)
static let disableCursorInteraction = Key<Bool>("disableCursorInteraction", default: false)

static let triggerKey = Key<Set<CGKeyCode>>("trigger", default: [.kVK_Function])
static let doubleClickToTrigger = Key<Bool>("doubleClickToTrigger", default: false)
Expand Down
5 changes: 4 additions & 1 deletion Loop/Managers/LoopManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ class LoopManager: ObservableObject {
self.targetWindow = WindowEngine.getTargetWindow()
self.initialMousePosition = NSEvent.mouseLocation
self.screenToResizeOn = NSScreen.screenWithMouse
self.mouseMovedEventMonitor!.start()

if !Defaults[.disableCursorInteraction] {
self.mouseMovedEventMonitor!.start()
}

if !Defaults[.hideUntilDirectionIsChosen] {
self.openWindows()
Expand Down
2 changes: 2 additions & 0 deletions Loop/Settings/RadialMenuSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct RadialMenuSettingsView: View {
@Default(.radialMenuCornerRadius) var radialMenuCornerRadius
@Default(.radialMenuThickness) var radialMenuThickness
@Default(.hideUntilDirectionIsChosen) var hideUntilDirectionIsChosen
@Default(.disableCursorInteraction) var disableCursorInteraction

@State var currentResizeDirection: WindowDirection = .cycleTop

Expand Down Expand Up @@ -57,6 +58,7 @@ struct RadialMenuSettingsView: View {

Section {
Toggle("Hide until direction is chosen", isOn: $hideUntilDirectionIsChosen)
Toggle("Disable cursor interaction", isOn: $disableCursorInteraction)
}
}
.formStyle(.grouped)
Expand Down

0 comments on commit 4f0865a

Please sign in to comment.