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"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
shouldAutocreateTestPlan = "YES">
|
<TestPlans>
|
||||||
|
<TestPlanReference
|
||||||
|
reference = "container:DockPhobia.xctestplan"
|
||||||
|
default = "YES">
|
||||||
|
</TestPlanReference>
|
||||||
|
</TestPlans>
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO"
|
skipped = "NO"
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "315"
|
startingLineNumber = "335"
|
||||||
endingLineNumber = "315"
|
endingLineNumber = "335"
|
||||||
landmarkName = "moveDock(_:)"
|
landmarkName = "moveDock(_:)"
|
||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@@ -62,8 +62,8 @@
|
|||||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "297"
|
startingLineNumber = "317"
|
||||||
endingLineNumber = "297"
|
endingLineNumber = "317"
|
||||||
landmarkName = "getScreenSize()"
|
landmarkName = "getScreenSize()"
|
||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@@ -78,8 +78,8 @@
|
|||||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "311"
|
startingLineNumber = "331"
|
||||||
endingLineNumber = "311"
|
endingLineNumber = "331"
|
||||||
landmarkName = "getScreenSize()"
|
landmarkName = "getScreenSize()"
|
||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@@ -132,22 +132,6 @@
|
|||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</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
|
<BreakpointProxy
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
<BreakpointContent
|
<BreakpointContent
|
||||||
@@ -164,5 +148,101 @@
|
|||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</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>
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ func osascript(_ script: String) -> String? {
|
|||||||
process.standardError = outputErrorPipe
|
process.standardError = outputErrorPipe
|
||||||
|
|
||||||
process.launch()
|
process.launch()
|
||||||
process.waitUntilExit()
|
// process.waitUntilExit()
|
||||||
|
|
||||||
let outputHandle = outputPipe.fileHandleForReading.readDataToEndOfFile()
|
let outputHandle = outputPipe.fileHandleForReading.readDataToEndOfFile()
|
||||||
let outputErrorHandle = outputErrorPipe.fileHandleForReading.readDataToEndOfFile()
|
let outputErrorHandle = outputErrorPipe.fileHandleForReading.readDataToEndOfFile()
|
||||||
@@ -242,7 +242,8 @@ func calcDockFromLeft() -> CGFloat {
|
|||||||
|
|
||||||
func startTrackingMouse() {
|
func startTrackingMouse() {
|
||||||
let mask = CGEventMask(1 << CGEventType.mouseMoved.rawValue)
|
let mask = CGEventMask(1 << CGEventType.mouseMoved.rawValue)
|
||||||
|
var dockSide = getDockSide()
|
||||||
|
var lastMove = Date.now
|
||||||
//try creating event tap
|
//try creating event tap
|
||||||
eventTap = CGEvent.tapCreate(
|
eventTap = CGEvent.tapCreate(
|
||||||
tap: .cgSessionEventTap,
|
tap: .cgSessionEventTap,
|
||||||
@@ -254,6 +255,26 @@ func startTrackingMouse() {
|
|||||||
// print("mouse at \(location)")
|
// print("mouse at \(location)")
|
||||||
// print("mouse at \(event.location)")
|
// print("mouse at \(event.location)")
|
||||||
//TODO: add Dock moving here
|
//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)
|
return Unmanaged.passRetained(event)
|
||||||
},
|
},
|
||||||
userInfo: nil
|
userInfo: nil
|
||||||
@@ -271,7 +292,6 @@ func startTrackingMouse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func stopTrackingMouse() {
|
func stopTrackingMouse() {
|
||||||
if let eventTap = eventTap {
|
if let eventTap = eventTap {
|
||||||
// disable event tap
|
// disable event tap
|
||||||
@@ -312,11 +332,11 @@ func getScreenSize() -> (x: CGFloat, y: CGFloat) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func moveDock(_ to: String) {
|
func moveDock(_ to: String) {
|
||||||
let validPos = ["left", "bottom", "right"]
|
// let validPos = ["left", "bottom", "right"]
|
||||||
guard validPos.contains(to) else {
|
// guard validPos.contains(to) else {
|
||||||
print("invalid dock position")
|
// print("invalid dock position")
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
let script = """
|
let script = """
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell dock preferences
|
tell dock preferences
|
||||||
|
|||||||
@@ -4,16 +4,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>NSAppleEventsUsageDescription</key>
|
<key>NSAppleEventsUsageDescription</key>
|
||||||
<string>allow it</string>
|
<string>allow it</string>
|
||||||
<key>NSAccessibilitysUsageDescription</key>
|
|
||||||
<string>allow it</string>
|
|
||||||
<key>com.apple.security.automation.apple-events</key>
|
<key>com.apple.security.automation.apple-events</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.scripting-targets</key>
|
|
||||||
<dict>
|
|
||||||
<key>com.apple.mail</key>
|
|
||||||
<array>
|
|
||||||
<string>com.apple.mail.compose</string>
|
|
||||||
</array>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</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