mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
formatting, debug stuff
This commit is contained in:
@@ -64,12 +64,12 @@ class MouseTracker {
|
|||||||
|
|
||||||
func checkMouse(_ event: NSEvent) {
|
func checkMouse(_ event: NSEvent) {
|
||||||
let location = event.mouseLocationCG
|
let location = event.mouseLocationCG
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var cgpointForSkyHigh = NSEvent.mouseLocation
|
var cgpointForSkyHigh = NSEvent.mouseLocation
|
||||||
cgpointForSkyHigh.x -= 20
|
cgpointForSkyHigh.x -= 20
|
||||||
cgpointForSkyHigh.y -= 5
|
cgpointForSkyHigh.y -= 5
|
||||||
skyHigh.move(to: cgpointForSkyHigh)
|
skyHigh.move(to: cgpointForSkyHigh)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
guard settings.settings.checkFullscreen else {
|
guard settings.settings.checkFullscreen else {
|
||||||
handleDockValue(dockIsAt: currentDockSide, location: location)
|
handleDockValue(dockIsAt: currentDockSide, location: location)
|
||||||
@@ -127,12 +127,18 @@ class MouseTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func start() {
|
func start() {
|
||||||
|
#if DEBUG
|
||||||
|
skyHigh.show()
|
||||||
|
#endif
|
||||||
self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved, handler: checkMouse)
|
self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved, handler: checkMouse)
|
||||||
self.running = true
|
self.running = true
|
||||||
print("started tracking")
|
print("started tracking")
|
||||||
}
|
}
|
||||||
|
|
||||||
func stop() {
|
func stop() {
|
||||||
|
#if DEBUG
|
||||||
|
skyHigh.hide()
|
||||||
|
#endif
|
||||||
if let monitor = monitor {
|
if let monitor = monitor {
|
||||||
NSEvent.removeMonitor(monitor)
|
NSEvent.removeMonitor(monitor)
|
||||||
self.running = false
|
self.running = false
|
||||||
@@ -177,15 +183,15 @@ class MouseTracker {
|
|||||||
|
|
||||||
func moveDock(_ toSide: DockSide) {
|
func moveDock(_ toSide: DockSide) {
|
||||||
guard currentDockSide != toSide else { return }
|
guard currentDockSide != toSide else { return }
|
||||||
// let scriptHide = """
|
// let scriptHide = """
|
||||||
// tell application "System Events"
|
// tell application "System Events"
|
||||||
// tell dock preferences
|
// tell dock preferences
|
||||||
// set autohide to true
|
// set autohide to true
|
||||||
// end tell
|
// end tell
|
||||||
// end tell
|
// end tell
|
||||||
// """
|
// """
|
||||||
//
|
//
|
||||||
// let scriptShow = scriptHide.replacingOccurrences(of: "true", with: "false")
|
// let scriptShow = scriptHide.replacingOccurrences(of: "true", with: "false")
|
||||||
|
|
||||||
let scriptMove = """
|
let scriptMove = """
|
||||||
tell application "System Events"
|
tell application "System Events"
|
||||||
@@ -194,9 +200,9 @@ class MouseTracker {
|
|||||||
end tell
|
end tell
|
||||||
end tell
|
end tell
|
||||||
"""
|
"""
|
||||||
// applescript(scriptHide)
|
// applescript(scriptHide)
|
||||||
applescript(scriptMove)
|
applescript(scriptMove)
|
||||||
// applescript(scriptShow)
|
// applescript(scriptShow)
|
||||||
currentDockSide = toSide
|
currentDockSide = toSide
|
||||||
settings.settings.dockMoves += 1
|
settings.settings.dockMoves += 1
|
||||||
refreshMenus()
|
refreshMenus()
|
||||||
|
|||||||
@@ -35,9 +35,6 @@ class SkyHigh {
|
|||||||
window.ignoresMouseEvents = true
|
window.ignoresMouseEvents = true
|
||||||
window.hasShadow = true
|
window.hasShadow = true
|
||||||
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllSpaces.union(.stationary)
|
window.collectionBehavior = NSWindow.CollectionBehavior.canJoinAllSpaces.union(.stationary)
|
||||||
#if DEBUG
|
|
||||||
show()
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func move(to: CGPoint) {
|
func move(to: CGPoint) {
|
||||||
|
|||||||
Reference in New Issue
Block a user