mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
swattign all the bugs
meybe fix memory leak fix a lot of stuff, improvemetns
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"python.analysis.typeCheckingMode" : "strict",
|
||||
"python.pipRequirements" : "DockPhobiaPy\/requirements.txt"
|
||||
"python.interpreter" : ".\/DockPhobiaPy\/venv\/bin\/python3",
|
||||
"python.pipRequirements" : "DockPhobiaPy\/requirements.txt",
|
||||
"python.pythonPath" : "\/Users\/neon443\/Documents\/Xcode\/DockPhobia\/DockPhobiaPy\/venv\/bin\/python3"
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"actions" : {
|
||||
"build" : {
|
||||
"enabled" : true,
|
||||
"script" : "#!\/bin\/sh\ncd DockPhobiaPy\npython3 -m venv venv\n. venv\/bin\/activate\npip3 install -r requirements.txt"
|
||||
},
|
||||
"clean" : {
|
||||
"enabled" : true,
|
||||
"script" : "#!\/bin\/sh\ncd DockPhobiaPy\n. venv\/bin\/activate\npip3 freeze > requirements.txt\nrm -rf venv"
|
||||
},
|
||||
"run" : {
|
||||
"enabled" : true,
|
||||
"script" : "#!\/bin\/sh\ncd DockPhobiaPy\n. venv\/bin\/activate\npython3 main.py"
|
||||
}
|
||||
},
|
||||
"openLogOnRun" : "start"
|
||||
}
|
||||
37
.nova/Tasks/Python Debug.json
Normal file
37
.nova/Tasks/Python Debug.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"actions" : {
|
||||
"build" : {
|
||||
"postActions" : [
|
||||
{
|
||||
"script" : "cd DockPhobiaPy\npython3 -m venv venv\n. venv\/bin\/activate\npip3 install -r requirements.txt",
|
||||
"type" : "runScript"
|
||||
}
|
||||
]
|
||||
},
|
||||
"clean" : {
|
||||
"postActions" : [
|
||||
{
|
||||
"script" : "cd DockPhobiaPy\n. venv\/bin\/activate\npip3 freeze > requirements.txt\nrm -rf venv",
|
||||
"type" : "runScript"
|
||||
}
|
||||
]
|
||||
},
|
||||
"run" : {
|
||||
"postActions" : [
|
||||
{
|
||||
"script" : ". DockPhobiaPy\/yvenv\/bin\/activate",
|
||||
"type" : "runScript"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"extension" : {
|
||||
"identifier" : "panic.Python",
|
||||
"name" : "Python"
|
||||
},
|
||||
"extensionTemplate" : "pythonDebug",
|
||||
"extensionValues" : {
|
||||
"python.debug.script" : "main.py",
|
||||
"python.debug.workingDirectory" : "DockPhobiaPy"
|
||||
}
|
||||
}
|
||||
21
.nova/Tasks/Virtual Environment.json
Normal file
21
.nova/Tasks/Virtual Environment.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"actions" : {
|
||||
"run" : {
|
||||
"postActions" : [
|
||||
{
|
||||
"script" : "python3 main.py",
|
||||
"type" : "runScript"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"extension" : {
|
||||
"identifier" : "net.danwatson.Python",
|
||||
"name" : "Python"
|
||||
},
|
||||
"extensionTemplate" : "virtualenv",
|
||||
"extensionValues" : {
|
||||
"script" : "*Py\/main.py",
|
||||
"workdir" : "."
|
||||
}
|
||||
}
|
||||
BIN
DockPhobiaPy/.DS_Store
vendored
BIN
DockPhobiaPy/.DS_Store
vendored
Binary file not shown.
@@ -1,18 +1,19 @@
|
||||
from pynput.mouse import Button, Controller
|
||||
from pynput.mouse import Controller
|
||||
import subprocess
|
||||
import time
|
||||
import AppKit
|
||||
import time
|
||||
import pdb
|
||||
from memory_profiler import profile
|
||||
|
||||
mouse = Controller()
|
||||
#while True:
|
||||
|
||||
|
||||
def getDockSide():
|
||||
# pdb.set_trace()
|
||||
script = "defaults read com.apple.Dock orientation"
|
||||
result = subprocess.run(["bash", "-c", script], capture_output=True,text=True)
|
||||
return result.stdout
|
||||
|
||||
formattedResult = result.stdout.strip()
|
||||
return formattedResult
|
||||
|
||||
|
||||
def moveDock(to):
|
||||
script = f"""
|
||||
@@ -43,7 +44,6 @@ def getScreenSize():
|
||||
return []
|
||||
|
||||
screenSize = getScreenSize()
|
||||
print(f"Screen size: {screenSize}")
|
||||
|
||||
def getDockHeight():
|
||||
screen = AppKit.NSScreen.mainScreen()
|
||||
@@ -53,67 +53,88 @@ def getDockHeight():
|
||||
|
||||
dockHeight = fullHeight - visibleHeight
|
||||
percentage = (dockHeight / fullHeight)
|
||||
return percentage+0.05 # increase size
|
||||
return percentage
|
||||
|
||||
screenSize = getScreenSize()
|
||||
|
||||
print(getDockHeight())
|
||||
print(getScreenSize())
|
||||
moveDock("bottom")
|
||||
dockSide = "bottom"
|
||||
dockHeight = getDockHeight()
|
||||
# moveDock("bottom")
|
||||
dockSide = getDockSide()
|
||||
startedOutAt = dockSide
|
||||
|
||||
print()
|
||||
dockFromBottom = screenSize[1]-(screenSize[1]*dockHeight)
|
||||
def calcDockFromBottom():
|
||||
# screenSize = getScreenSize()
|
||||
dockHeight = getDockHeight()
|
||||
return screenSize[1]-(screenSize[1]*dockHeight)
|
||||
|
||||
dockFromBottom = calcDockFromBottom()
|
||||
print(dockFromBottom)
|
||||
|
||||
print()
|
||||
dockFromLeft = screenSize[1]*dockHeight
|
||||
def calcDockFromLeft():
|
||||
# screenSize = getScreenSize()
|
||||
dockHeight = getDockHeight()
|
||||
return screenSize[1]*dockHeight
|
||||
|
||||
dockFromLeft = calcDockFromLeft()
|
||||
print(dockFromLeft)
|
||||
|
||||
print()
|
||||
dockFromRight = screenSize[1]*dockHeight
|
||||
dockFromRight = screenSize[0]-(screenSize[1]*dockHeight)
|
||||
def calcDockFromRight():
|
||||
# screenSize = getScreenSize()
|
||||
dockHeight = getDockHeight()
|
||||
return screenSize[0]-(screenSize[1]*dockHeight)
|
||||
dockFromRight = calcDockFromRight()
|
||||
print(dockFromRight)
|
||||
|
||||
@profile
|
||||
def run_loop():
|
||||
global dockSide, dockFromBottom, dockFromLeft, dockFromRight, startedOutAt
|
||||
|
||||
while True:
|
||||
# for i in range(0,100000):
|
||||
if dockSide == "bottom":
|
||||
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
|
||||
# neverbeenside = False
|
||||
|
||||
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
|
||||
|
||||
if startedOutAt == "":
|
||||
continue
|
||||
elif startedOutAt == "bottom" and dockSide != "bottom":
|
||||
# started at bottom, dock is at side, recalc the actuation distance from sides
|
||||
dockFromLeft = calcDockFromLeft()
|
||||
dockFromRight = calcDockFromRight()
|
||||
startedOutAt = ""
|
||||
elif startedOutAt == "right" or startedOutAt == "left" and dockSide == "bottom":
|
||||
#started on the side, now at bottom recalc the distance from bottom
|
||||
dockFromBottom = calcDockFromBottom()
|
||||
startedOutAt = ""
|
||||
time.sleep(0.001)
|
||||
|
||||
while True:
|
||||
# print(dockSide)
|
||||
if dockSide == "bottom":
|
||||
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)
|
||||
run_loop()
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
debugpy==1.8.13
|
||||
memory-profiler==0.61.0
|
||||
MouseInfo==0.1.3
|
||||
psutil==7.0.0
|
||||
PyAutoGUI==0.9.54
|
||||
PyGetWindow==0.0.9
|
||||
PyMsgBox==1.0.9
|
||||
|
||||
Reference in New Issue
Block a user