mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
poc: it works fully, but its hardcoded, need to get dock height programmatically
This commit is contained in:
@@ -301,7 +301,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DockPhobia;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -334,7 +334,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.DockPhobia;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -18,7 +18,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||
if let button = statusItem.button {
|
||||
button.image = NSImage(named: "cursor")
|
||||
button.image = NSImage(named: "cursor.slash")
|
||||
}
|
||||
setupMenus()
|
||||
}
|
||||
@@ -41,8 +41,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
|
||||
func changeMenuIcon(running: Bool) {
|
||||
if let button = statusItem.button {
|
||||
button.image = NSImage(named: "cursor\(running ? ".motion" : "")")
|
||||
guard let button = statusItem.button else { return }
|
||||
switch running {
|
||||
case true:
|
||||
button.image = NSImage(named: "cursor.motion")
|
||||
case false:
|
||||
button.image = NSImage(named: "cursor.slash")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,6 @@ class MouseTracker {
|
||||
} else {
|
||||
fatalError("no screen wtf???")
|
||||
}
|
||||
moveDock(.left)
|
||||
moveDock(.bottom)
|
||||
}
|
||||
|
||||
func checkMouse(_ event: NSEvent) {
|
||||
@@ -48,7 +46,31 @@ class MouseTracker {
|
||||
print(location)
|
||||
#endif
|
||||
if location.y > 1000 {
|
||||
|
||||
if location.x < screen.width/2 {
|
||||
moveDock(.right)
|
||||
return
|
||||
} else {
|
||||
moveDock(.left)
|
||||
return
|
||||
}
|
||||
}
|
||||
if location.x < 100 {
|
||||
if location.y < screen.height/2 {
|
||||
moveDock(.bottom)
|
||||
return
|
||||
} else {
|
||||
moveDock(.right)
|
||||
return
|
||||
}
|
||||
}
|
||||
if location.x > 1600 {
|
||||
if location.y < screen.height/2 {
|
||||
moveDock(.bottom)
|
||||
return
|
||||
} else {
|
||||
moveDock(.left)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user