Skip to content

Commit

Permalink
Merge pull request #2 from odknt/improve_linux_support
Browse files Browse the repository at this point in the history
LINUX: Fix _getAllMonitorsDict() crashes when _NET_WORKAREA is not set
  • Loading branch information
Kalmat authored Oct 4, 2023
2 parents acf1dd1 + f332b18 commit 3ee2441
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pymonctl/_pymonctl_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def _getAllMonitorsDict() -> dict[str, ScreenValue]:
x, y, w, h = monitor.x, monitor.y, monitor.width_in_pixels, monitor.height_in_pixels
# https://askubuntu.com/questions/1124149/how-to-get-taskbar-size-and-position-with-python
wa: List[int] = getPropertyValue(getProperty(window=root, prop=Props.Root.WORKAREA, display=display), display=display)
wx, wy, wr, wb = wa[0], wa[1], wa[2], wa[3]
if isinstance(wa, list) and len(wa) >= 4:
wx, wy, wr, wb = wa[0], wa[1], wa[2], wa[3]
else:
wx, wy, wr, wb = x, y, w, h
dpiX, dpiY = round((w * 25.4) / (monitor.width_in_millimeters or 1)), round((h * 25.4) / (monitor.height_in_millimeters or 1))
scaleX, scaleY = _scale(monitorName) or (0.0, 0.0)
rot = int(math.log(crtcInfo.rotation, 2))
Expand Down

0 comments on commit 3ee2441

Please sign in to comment.