diff --git a/DockPhobia.xcodeproj/project.pbxproj b/DockPhobia.xcodeproj/project.pbxproj index c853e1d..d9d2c3c 100644 --- a/DockPhobia.xcodeproj/project.pbxproj +++ b/DockPhobia.xcodeproj/project.pbxproj @@ -284,7 +284,8 @@ COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 8JGND254B7; - ENABLE_HARDENED_RUNTIME = YES; + ENABLE_HARDENED_RUNTIME = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; INFOPLIST_KEY_NSMainNibFile = MainMenu; @@ -313,7 +314,8 @@ COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 8JGND254B7; - ENABLE_HARDENED_RUNTIME = YES; + ENABLE_HARDENED_RUNTIME = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_NSHumanReadableCopyright = ""; INFOPLIST_KEY_NSMainNibFile = MainMenu; diff --git a/DockPhobia/DockPhobia.entitlements b/DockPhobia/DockPhobia.entitlements index 18aff0c..49ad0bb 100644 --- a/DockPhobia/DockPhobia.entitlements +++ b/DockPhobia/DockPhobia.entitlements @@ -2,9 +2,7 @@ - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only + com.apple.security.automation.apple-events diff --git a/DockPhobia/MouseTracker.swift b/DockPhobia/MouseTracker.swift index 670d898..ee4fa34 100644 --- a/DockPhobia/MouseTracker.swift +++ b/DockPhobia/MouseTracker.swift @@ -15,6 +15,12 @@ struct Screen { var height: CGFloat } +enum DockSide { + case left + case right + case bottom +} + class MouseTracker { var screen: Screen @@ -32,6 +38,7 @@ class MouseTracker { fatalError("no screen wtf???") } addMonitor() + moveDock(.left) } func checkMouse(_ event: NSEvent) { @@ -40,6 +47,9 @@ class MouseTracker { #if DEBUG print(location) #endif + if location.y > 1000 { + + } } func addMonitor() { @@ -50,6 +60,17 @@ class MouseTracker { NSEvent.removeMonitor(monitor as Any) } + func moveDock(_ toSide: DockSide) { + let script = """ + tell application "System Events" + tell dock preferences + set screen edge to \(toSide) + end tell + end tell + """ + applescript(script) + } + func applescript(_ script: String) { var error: NSDictionary? if let scriptObject = NSAppleScript(source: script) {