mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
idk what i did iforgot lol
This commit is contained in:
@@ -27,8 +27,13 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<TestPlans>
|
||||
<TestPlanReference
|
||||
reference = "container:DockPhobia.xctestplan"
|
||||
default = "YES">
|
||||
</TestPlanReference>
|
||||
</TestPlans>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "315"
|
||||
endingLineNumber = "315"
|
||||
startingLineNumber = "335"
|
||||
endingLineNumber = "335"
|
||||
landmarkName = "moveDock(_:)"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
@@ -62,8 +62,8 @@
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "297"
|
||||
endingLineNumber = "297"
|
||||
startingLineNumber = "317"
|
||||
endingLineNumber = "317"
|
||||
landmarkName = "getScreenSize()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
@@ -78,8 +78,8 @@
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "311"
|
||||
endingLineNumber = "311"
|
||||
startingLineNumber = "331"
|
||||
endingLineNumber = "331"
|
||||
landmarkName = "getScreenSize()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
@@ -132,22 +132,6 @@
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "ED43EB58-5195-4D34-AA9D-F580B9DAE105"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "151"
|
||||
endingLineNumber = "151"
|
||||
landmarkName = "shell(_:)"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
@@ -164,5 +148,101 @@
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "01A160FF-2749-45DF-9D30-B5B7FE7FF165"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "85"
|
||||
endingLineNumber = "85"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "09CCAEDC-6C49-494D-81EF-A1CD23F27CEB"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "244"
|
||||
endingLineNumber = "244"
|
||||
landmarkName = "startTrackingMouse()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "FFB47672-BB63-499A-86A2-584F4C3A558A"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "248"
|
||||
endingLineNumber = "248"
|
||||
landmarkName = "startTrackingMouse()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "0B2C5434-A906-4BC4-8D4B-E6EDA07FAFF3"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "254"
|
||||
endingLineNumber = "254"
|
||||
landmarkName = "startTrackingMouse()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "D910D5DA-8F27-44FC-A8CD-A2C4C37A88EE"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "291"
|
||||
endingLineNumber = "291"
|
||||
landmarkName = "startTrackingMouse()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "D8949838-017D-4415-B906-C9E2524709C4"
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "264"
|
||||
endingLineNumber = "264"
|
||||
landmarkName = "startTrackingMouse()"
|
||||
landmarkType = "9">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@@ -165,7 +165,7 @@ func osascript(_ script: String) -> String? {
|
||||
process.standardError = outputErrorPipe
|
||||
|
||||
process.launch()
|
||||
process.waitUntilExit()
|
||||
// process.waitUntilExit()
|
||||
|
||||
let outputHandle = outputPipe.fileHandleForReading.readDataToEndOfFile()
|
||||
let outputErrorHandle = outputErrorPipe.fileHandleForReading.readDataToEndOfFile()
|
||||
@@ -242,7 +242,8 @@ func calcDockFromLeft() -> CGFloat {
|
||||
|
||||
func startTrackingMouse() {
|
||||
let mask = CGEventMask(1 << CGEventType.mouseMoved.rawValue)
|
||||
|
||||
var dockSide = getDockSide()
|
||||
var lastMove = Date.now
|
||||
//try creating event tap
|
||||
eventTap = CGEvent.tapCreate(
|
||||
tap: .cgSessionEventTap,
|
||||
@@ -254,6 +255,26 @@ func startTrackingMouse() {
|
||||
// print("mouse at \(location)")
|
||||
// print("mouse at \(event.location)")
|
||||
//TODO: add Dock moving here
|
||||
var lastDockMoveTime = Date()
|
||||
let debounceInterval: TimeInterval = 0.1
|
||||
if Date().timeIntervalSince(lastDockMoveTime) > debounceInterval {
|
||||
if event.location.y > 1000 {
|
||||
lastDockMoveTime = Date()
|
||||
Task {
|
||||
moveDock("left")
|
||||
}
|
||||
} else if event.location.x < 100 {
|
||||
lastDockMoveTime = Date()
|
||||
Task {
|
||||
moveDock("right")
|
||||
}
|
||||
} else if event.location.x > 1600 {
|
||||
lastDockMoveTime = Date()
|
||||
Task {
|
||||
moveDock("bottom")
|
||||
}
|
||||
}
|
||||
}
|
||||
return Unmanaged.passRetained(event)
|
||||
},
|
||||
userInfo: nil
|
||||
@@ -271,7 +292,6 @@ func startTrackingMouse() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func stopTrackingMouse() {
|
||||
if let eventTap = eventTap {
|
||||
// disable event tap
|
||||
@@ -312,11 +332,11 @@ func getScreenSize() -> (x: CGFloat, y: CGFloat) {
|
||||
}
|
||||
|
||||
func moveDock(_ to: String) {
|
||||
let validPos = ["left", "bottom", "right"]
|
||||
guard validPos.contains(to) else {
|
||||
print("invalid dock position")
|
||||
return
|
||||
}
|
||||
// let validPos = ["left", "bottom", "right"]
|
||||
// guard validPos.contains(to) else {
|
||||
// print("invalid dock position")
|
||||
// return
|
||||
// }
|
||||
let script = """
|
||||
tell application "System Events"
|
||||
tell dock preferences
|
||||
|
||||
@@ -4,16 +4,7 @@
|
||||
<dict>
|
||||
<key>NSAppleEventsUsageDescription</key>
|
||||
<string>allow it</string>
|
||||
<key>NSAccessibilitysUsageDescription</key>
|
||||
<string>allow it</string>
|
||||
<key>com.apple.security.automation.apple-events</key>
|
||||
<true/>
|
||||
<key>com.apple.security.scripting-targets</key>
|
||||
<dict>
|
||||
<key>com.apple.mail</key>
|
||||
<array>
|
||||
<string>com.apple.mail.compose</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
BIN
DockPhobiaAppIcon.png
Normal file
BIN
DockPhobiaAppIcon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 576 KiB |
Reference in New Issue
Block a user