Skip to content

Commit

Permalink
fix(bar): prevent processing desktop windows in foreground check
Browse files Browse the repository at this point in the history
  • Loading branch information
amnweb committed Feb 19, 2025
1 parent 86fe838 commit 01c3876
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,15 @@ def is_foreground_fullscreen(self):
hwnd = win32gui.GetForegroundWindow()
if not hwnd:
return

hwnd_class_name = win32gui.GetClassName(hwnd)

# Check if the foreground window is the desktop
if hwnd_class_name in ["Progman", "WorkerW"]:
return
# Get the window rectangle: (left, top, right, bottom) then convert to (x, y, width, height)
rect = win32gui.GetWindowRect(hwnd)
window_rect = (rect[0], rect[1], rect[2] - rect[0], rect[3] - rect[1])

# Get the primary screen geometry
screen_geometry = self.screen().geometry()
screen_rect = (
Expand All @@ -221,6 +225,7 @@ def is_foreground_fullscreen(self):
screen_geometry.width(),
screen_geometry.height()
)

# Determine fullscreen state
is_fullscreen = (window_rect == screen_rect)
# Cache the previous state so we only update if it changes
Expand Down

0 comments on commit 01c3876

Please # to comment.