we can do most of the stuff in the python rewrite, screen size getting 
move dock 
get dock height
now just need to bring it together
This commit is contained in:
neon443
2025-03-15 15:20:36 +00:00
parent 90376a0857
commit 329f972afb
5 changed files with 104 additions and 32 deletions

68
DockPhobiaPy/main.py Normal file
View File

@@ -0,0 +1,68 @@
from pynput.mouse import Button, Controller
import subprocess
import time
import AppKit
mouse = Controller()
#while True:
def getDockSide():
script = "defaults read com.apple.Dock orientation"
result = subprocess.run(["bash", "-c", script], capture_output=True,text=True)
if result.stdout != None:
print(result.stdout)
dockSide = getDockSide()
def moveDock(to):
script = f"""
tell application "System Events"
tell dock preferences
set screen edge to {to}
end tell
end tell
"""
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
# print(result.stdout)
def getScreenSize():
script = """
tell application "Finder"
get bounds of window of desktop
end tell
"""
result = subprocess.run(["osascript", "-e", script], capture_output=True, text=True)
try:
resultArr = [int(num) for num in result.stdout.strip().split(", ")]
resultArr = resultArr[2:]
print("sdfioewiofj ", resultArr)
return resultArr
except ValueError:
print("error parsing screensize")
return []
screenSize = getScreenSize()
print(f"Screen size: {screenSize}")
def getDockHeight():
screen = AppKit.NSScreen.mainScreen()
fullHeight = screen.frame().size.height
visibleHeight = screen.visibleFrame().size.height
dockHeight = fullHeight - visibleHeight
print(dockHeight)
percentage = (dockHeight / fullHeight) * 100
return percentage
moveDock("left")
time.sleep(0.1)
moveDock("bottom")
print("mousepos", mouse.position)
screenSize = getScreenSize()
print(screenSize)
while True:
if mouse.position[1] > 2600:
moveDock("left")
time.sleep(0.1)

View File

@@ -0,0 +1,16 @@
MouseInfo==0.1.3
PyAutoGUI==0.9.54
PyGetWindow==0.0.9
PyMsgBox==1.0.9
pynput==1.8.0
pyobjc-core==11.0
pyobjc-framework-ApplicationServices==11.0
pyobjc-framework-Cocoa==11.0
pyobjc-framework-CoreText==11.0
pyobjc-framework-Quartz==11.0
pyperclip==1.9.0
PyRect==0.2.0
PyScreeze==1.0.1
pytweening==1.2.0
rubicon-objc==0.5.0
six==1.17.0