Skip to content

Commit

Permalink
Added Process window block list
Browse files Browse the repository at this point in the history
- There are some window process like PopupHost which is for mouse hovering event.
  • Loading branch information
KillerBOSS2019 committed May 21, 2022
1 parent 89b425a commit f0b1d06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.tpp
19 changes: 14 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,20 @@
"MONITOR_DEFAULTTOPRIMARY": 1,
"MONITOR_DEFAULTTONEAREST": 2
}

WNDENUMPROC = ctypes.WINFUNCTYPE(
wintypes.BOOL,
wintypes.HWND,
wintypes.LPARAM
)

processBlocklist = [
"PopupHost",
"NVIDIA GeForce Overlay",
"NVIDIA GPU Activity\n",
"Windows Input Experience"
]

def list_windows():
OptionList = []
@WNDENUMPROC
Expand All @@ -39,7 +48,8 @@ def enum_proc(hWnd, lParam):
OptionList.append(title.value)
return True
user32.EnumWindows(enum_proc, 0)
return list(set(sorted(OptionList)))
ProcessList = list(set(sorted(OptionList)))
return [process for process in ProcessList if not process in processBlocklist]

def getMonitorFriendlyName(): # Not sure how to use this correctly bc theres no way for me to verify which is which example \\\\.\\DISPLAY0
systemencoding = windll.kernel32.GetConsoleOutputCP()
Expand Down Expand Up @@ -245,7 +255,6 @@ def CustomAction(Title, x, y, width, hight):

def stateUpdate():
global runOnce
monitor = []

if not runOnce:
print("running once")
Expand All @@ -256,7 +265,7 @@ def stateUpdate():
runOnce = True

while running:
monitor = [list(each.keys())[0] for each in get_desktop()]
monitor = [list(each.keys())[0].rstrip() for each in get_desktop()]

if TPClient.choiceUpdateList.get("KillerBOSS.TP.Plugins.WindowMover.Windowpresets.Displays") != monitor:
TPClient.choiceUpdate("KillerBOSS.TP.Plugins.WindowMover.Windowpresets.Displays", monitor)
Expand All @@ -265,7 +274,7 @@ def stateUpdate():

if TPClient.choiceUpdateList.get("KillerBOSS.TP.Plugins.WindowMover.customMove.Window") != (processWindow := list_windows()):
TPClient.choiceUpdate("KillerBOSS.TP.Plugins.WindowMover.customMove.Window", processWindow)
print("Updating process list")
print("Updating process list", processWindow)

try:
currentFocusedWindow = gw.getActiveWindowTitle()
Expand Down Expand Up @@ -418,12 +427,12 @@ def Onconnect(data):
@TPClient.on(TYPES.onShutdown)
def Shutdown(data):
global running
running = False
try:
TPClient.settingUpdate("Is Running","False")
except:
pass
TPClient.disconnect()
running = False
sys.exit()

TPClient.connect()

0 comments on commit f0b1d06

Please sign in to comment.