Refactor imports in ProjectView for clarity and maintainability

This commit is contained in:
2025-09-16 16:51:21 +02:00
parent cf44597268
commit cb4fd02a42
5 changed files with 371 additions and 0 deletions

13
croppa/utils.py Normal file
View File

@@ -0,0 +1,13 @@
import ctypes
def get_active_window_title():
"""Get the title of the currently active window"""
try:
hwnd = ctypes.windll.user32.GetForegroundWindow()
length = ctypes.windll.user32.GetWindowTextLengthW(hwnd)
buffer = ctypes.create_unicode_buffer(length + 1)
ctypes.windll.user32.GetWindowTextW(hwnd, buffer, length + 1)
return buffer.value
except: # noqa: E722 - preserve original broad exception style
return ""