mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 14:56:16 +00:00
DONE!!!!!!!!!!!!!
now the values are fetched programmatically!! btw if ur screen size changes, or ur dock size changes, restart the program not dynamically updating yet
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
<string>allow it</string>
|
<string>allow it</string>
|
||||||
<key>NSAccessibilitysUsageDescription</key>
|
<key>NSAccessibilitysUsageDescription</key>
|
||||||
<string>allow it</string>
|
<string>allow it</string>
|
||||||
<com.apple.security.automation.apple-events>
|
<key>com.apple.security.automation.apple-events<>
|
||||||
|
<true>
|
||||||
<key>com.apple.security.scripting-targets</key>
|
<key>com.apple.security.scripting-targets</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.mail</key>
|
<key>com.apple.mail</key>
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ from pynput.mouse import Button, Controller
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import AppKit
|
import AppKit
|
||||||
|
import pdb
|
||||||
|
|
||||||
mouse = Controller()
|
mouse = Controller()
|
||||||
#while True:
|
#while True:
|
||||||
|
|
||||||
|
|
||||||
def getDockSide():
|
def getDockSide():
|
||||||
|
# pdb.set_trace()
|
||||||
script = "defaults read com.apple.Dock orientation"
|
script = "defaults read com.apple.Dock orientation"
|
||||||
result = subprocess.run(["bash", "-c", script], capture_output=True,text=True)
|
result = subprocess.run(["bash", "-c", script], capture_output=True,text=True)
|
||||||
if result.stdout != None:
|
return result.stdout
|
||||||
print(result.stdout)
|
|
||||||
dockSide = getDockSide()
|
|
||||||
|
|
||||||
def moveDock(to):
|
def moveDock(to):
|
||||||
script = f"""
|
script = f"""
|
||||||
@@ -22,6 +23,7 @@ def moveDock(to):
|
|||||||
end tell
|
end tell
|
||||||
"""
|
"""
|
||||||
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
|
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
|
||||||
|
return result.stdout
|
||||||
# print(result.stdout)
|
# print(result.stdout)
|
||||||
|
|
||||||
def getScreenSize():
|
def getScreenSize():
|
||||||
@@ -35,7 +37,6 @@ def getScreenSize():
|
|||||||
try:
|
try:
|
||||||
resultArr = [int(num) for num in result.stdout.strip().split(", ")]
|
resultArr = [int(num) for num in result.stdout.strip().split(", ")]
|
||||||
resultArr = resultArr[2:]
|
resultArr = resultArr[2:]
|
||||||
print("sdfioewiofj ", resultArr)
|
|
||||||
return resultArr
|
return resultArr
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("error parsing screensize")
|
print("error parsing screensize")
|
||||||
@@ -51,18 +52,68 @@ def getDockHeight():
|
|||||||
visibleHeight = screen.visibleFrame().size.height
|
visibleHeight = screen.visibleFrame().size.height
|
||||||
|
|
||||||
dockHeight = fullHeight - visibleHeight
|
dockHeight = fullHeight - visibleHeight
|
||||||
print(dockHeight)
|
percentage = (dockHeight / fullHeight)
|
||||||
percentage = (dockHeight / fullHeight) * 100
|
return percentage+0.03 # increase size
|
||||||
return percentage
|
|
||||||
|
|
||||||
moveDock("left")
|
|
||||||
time.sleep(0.1)
|
|
||||||
moveDock("bottom")
|
|
||||||
print("mousepos", mouse.position)
|
|
||||||
|
|
||||||
screenSize = getScreenSize()
|
screenSize = getScreenSize()
|
||||||
print(screenSize)
|
|
||||||
|
print(getDockHeight())
|
||||||
|
print(getScreenSize())
|
||||||
|
moveDock("bottom")
|
||||||
|
dockSide = "bottom"
|
||||||
|
dockHeight = getDockHeight()
|
||||||
|
|
||||||
|
print()
|
||||||
|
dockFromBottom = screenSize[1]-(screenSize[1]*dockHeight)
|
||||||
|
print(dockFromBottom)
|
||||||
|
|
||||||
|
print()
|
||||||
|
dockFromLeft = screenSize[1]*dockHeight
|
||||||
|
print(dockFromLeft)
|
||||||
|
|
||||||
|
print()
|
||||||
|
dockFromRight = screenSize[1]*dockHeight
|
||||||
|
dockFromRight = screenSize[0]-(screenSize[1]*dockHeight)
|
||||||
|
print(dockFromRight)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if mouse.position[1] > 2600:
|
# print(dockSide)
|
||||||
moveDock("left")
|
if dockSide == "bottom":
|
||||||
time.sleep(0.1)
|
if mouse.position[1] > dockFromBottom:
|
||||||
|
if mouse.position[0] < screenSize[0]/2:
|
||||||
|
moveDock("right")
|
||||||
|
dockSide = "right"
|
||||||
|
#if mouse is at bottom and is on the left
|
||||||
|
else:
|
||||||
|
moveDock("left")
|
||||||
|
dockSide = "left"
|
||||||
|
#mouse is at bottom but on the right of screen
|
||||||
|
|
||||||
|
elif dockSide == "left":
|
||||||
|
if mouse.position[0] < dockFromLeft:
|
||||||
|
if mouse.position[1] < screenSize[1]/2:
|
||||||
|
moveDock("bottom")
|
||||||
|
dockSide = "bottom"
|
||||||
|
#mouse is at left but top half
|
||||||
|
else:
|
||||||
|
moveDock("right")
|
||||||
|
dockSide = "right"
|
||||||
|
#mouse is at left but bottom half
|
||||||
|
|
||||||
|
elif dockSide == "right":
|
||||||
|
if mouse.position[0] > dockFromRight:
|
||||||
|
if mouse.position[1] < screenSize[1]/2:
|
||||||
|
moveDock("bottom")
|
||||||
|
dockSide = "bottom"
|
||||||
|
#mouse is at right but top half
|
||||||
|
else:
|
||||||
|
moveDock("left")
|
||||||
|
dockSide = "left"
|
||||||
|
#mouse is at right but bottom half
|
||||||
|
|
||||||
|
time.sleep(0.01)
|
||||||
|
|||||||
Reference in New Issue
Block a user