mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
rewrote getScreenSize() -> (x: Int, y: Int)
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "178"
|
startingLineNumber = "181"
|
||||||
endingLineNumber = "178"
|
endingLineNumber = "181"
|
||||||
landmarkName = "getDockSide()"
|
landmarkName = "getDockSide()"
|
||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
@@ -30,9 +30,57 @@
|
|||||||
filePath = "DockPhobia/DockPhobiaApp.swift"
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
startingColumnNumber = "9223372036854775807"
|
startingColumnNumber = "9223372036854775807"
|
||||||
endingColumnNumber = "9223372036854775807"
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "262"
|
||||||
|
endingLineNumber = "262"
|
||||||
|
landmarkName = "moveDock(_:)"
|
||||||
|
landmarkType = "9">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "F8A3FA77-893B-450F-AD59-E5BC7DCE49E3"
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "173"
|
||||||
|
endingLineNumber = "173"
|
||||||
|
landmarkName = "osascript(_:)"
|
||||||
|
landmarkType = "9">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "BD0ABCBD-CF09-4CA6-96F0-684CED97F209"
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "252"
|
||||||
|
endingLineNumber = "252"
|
||||||
|
landmarkName = "getScreenSize()"
|
||||||
|
landmarkType = "9">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
uuid = "24C8E220-523C-4656-897A-B41ABA405D6B"
|
||||||
|
shouldBeEnabled = "No"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "DockPhobia/DockPhobiaApp.swift"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
startingLineNumber = "258"
|
startingLineNumber = "258"
|
||||||
endingLineNumber = "258"
|
endingLineNumber = "258"
|
||||||
landmarkName = "moveDock(_:)"
|
landmarkName = "getScreenSize()"
|
||||||
landmarkType = "9">
|
landmarkType = "9">
|
||||||
</BreakpointContent>
|
</BreakpointContent>
|
||||||
</BreakpointProxy>
|
</BreakpointProxy>
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ func shell(_ command: String) -> (output: String?, error: String?) {
|
|||||||
return (output: output, error: outputError)
|
return (output: output, error: outputError)
|
||||||
}
|
}
|
||||||
|
|
||||||
func osascript(_ script: String) -> (output: String?, error: String?) {
|
func osascript(_ script: String) -> String? {
|
||||||
let process = Process()
|
let process = Process()
|
||||||
let outputPipe = Pipe()
|
let outputPipe = Pipe()
|
||||||
let outputErrorPipe = Pipe()
|
let outputErrorPipe = Pipe()
|
||||||
@@ -169,7 +169,10 @@ func osascript(_ script: String) -> (output: String?, error: String?) {
|
|||||||
.trimmingCharacters(
|
.trimmingCharacters(
|
||||||
in: .whitespacesAndNewlines
|
in: .whitespacesAndNewlines
|
||||||
)
|
)
|
||||||
return (outputData, outputErrorData)
|
if outputErrorData != "" {
|
||||||
|
print(outputErrorData as Any)
|
||||||
|
}
|
||||||
|
return outputData
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDockSide() -> String {
|
func getDockSide() -> String {
|
||||||
@@ -240,18 +243,19 @@ func stopTrackingMouse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getScreenSize() -> (x: CGFloat, y: CGFloat) {
|
func getScreenSize() -> (x: Int, y: Int) {
|
||||||
if let screen = NSScreen.main {
|
let script = """
|
||||||
let screenFrame = screen.frame
|
tell application "Finder"
|
||||||
let maxWidth = screenFrame.width
|
get bounds of window of desktop
|
||||||
let maxHeight = screenFrame.height
|
end tell
|
||||||
// print("screen res: \(maxWidth)x\(maxHeight)")
|
"""
|
||||||
return (maxWidth, maxHeight)
|
let result = osascript(script)?.dropFirst(6).split(separator: ", ")
|
||||||
} else {
|
// removes the "0, 0, " and splits into an arr
|
||||||
print("you have no screen")
|
let resultTuple = (
|
||||||
print("what the fuck")
|
Int( result![0] )!,
|
||||||
return (-1.0, -1.0) //help me... i am not accounting for edge cases like this shit
|
Int( result![1] )!
|
||||||
}
|
)
|
||||||
|
return resultTuple
|
||||||
}
|
}
|
||||||
|
|
||||||
func moveDock(_ to: String) {
|
func moveDock(_ to: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user