mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 23:06:17 +00:00
a lot faster now, it only moves the dock if the side its moving to is different
This commit is contained in:
@@ -85,8 +85,9 @@ class MouseTracker {
|
|||||||
} else {
|
} else {
|
||||||
fatalError("no screen wtf???")
|
fatalError("no screen wtf???")
|
||||||
}
|
}
|
||||||
self.currentDockSide = .bottom
|
self.currentDockSide = .left
|
||||||
moveDock(.bottom)
|
moveDock(.bottom)
|
||||||
|
currentDockSide = .bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkMouse(_ event: NSEvent) {
|
func checkMouse(_ event: NSEvent) {
|
||||||
@@ -143,14 +144,27 @@ class MouseTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func moveDock(_ toSide: DockSide) {
|
func moveDock(_ toSide: DockSide) {
|
||||||
let script = """
|
guard currentDockSide != toSide else { return }
|
||||||
|
// let scriptHide = """
|
||||||
|
// tell application "System Events"
|
||||||
|
// tell dock preferences
|
||||||
|
// set autohide to true
|
||||||
|
// end tell
|
||||||
|
// end tell
|
||||||
|
// """
|
||||||
|
//
|
||||||
|
// let scriptShow = scriptHide.replacingOccurrences(of: "true", with: "false")
|
||||||
|
|
||||||
|
let scriptMove = """
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
tell dock preferences
|
tell dock preferences
|
||||||
set screen edge to \(toSide)
|
set screen edge to \(toSide)
|
||||||
end tell
|
end tell
|
||||||
end tell
|
end tell
|
||||||
"""
|
"""
|
||||||
applescript(script)
|
// applescript(scriptHide)
|
||||||
|
applescript(scriptMove)
|
||||||
|
// applescript(scriptShow)
|
||||||
currentDockSide = toSide
|
currentDockSide = toSide
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user