da-rth / yasb

A highly configurable cross-platform (Windows) status bar written in Python.
MIT License
1.39k stars 81 forks source link

fix: Fix Monitor Specific Active Window Widget #142

Open robschreiber opened 4 months ago

robschreiber commented 4 months ago

Pull Request #86

Description

The Active Window widget does not appropriately determine whether or not the text should be hidden if the monitor exclusive option is set to true. I set up an alternate method to identify what monitor a widget is on in the logic to determine whether or not the window title text should be hidden.

PyQT6 QWidgets don't have access to the win32 hwnd info for a monitor, they just return //Display 1 or //Display 2. We can identify what monitor a widget is on by using the screens x-offset and the hwnd monitor_info's rectangle x value (0 for the leftmost monitor and whatever the horizontal resolution of the first monitor is for the second, and so on). Just in case somebody has vertically stacked mutltiple monitors, there is also a check for the y value.

Related Issue

Fixes Issue #86

Testing

I made the change yesterday in my personal config and everything is working fine.