From 709288d03433b2c9d7a9de23688e8a4874966d1a Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 5 Sep 2021 13:19:27 -0400 Subject: [PATCH] Sway fixes that avoid weird window resizing --- piker/ui/_style.py | 6 ++++++ piker/ui/_window.py | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/piker/ui/_style.py b/piker/ui/_style.py index 2b73b0df..c1f151f4 100644 --- a/piker/ui/_style.py +++ b/piker/ui/_style.py @@ -102,6 +102,12 @@ class DpiAwareFont: # take the max since scaling can make things ugly in some cases pdpi = screen.physicalDotsPerInch() ldpi = screen.logicalDotsPerInch() + + # XXX: this is needed on sway/wayland where you set + # ``QT_WAYLAND_FORCE_DPI=physical`` + if ldpi == 0: + ldpi = pdpi + mx_dpi = max(pdpi, ldpi) mn_dpi = min(pdpi, ldpi) scale = round(ldpi/pdpi) diff --git a/piker/ui/_window.py b/piker/ui/_window.py index a97b1f84..17c97411 100644 --- a/piker/ui/_window.py +++ b/piker/ui/_window.py @@ -148,12 +148,17 @@ class MultiStatus: class MainWindow(QtGui.QMainWindow): - size = (800, 500) + # XXX: for tiling wms this should scale + # with the alloted window size. + # TODO: detect for tiling and if untrue set some size? + # size = (300, 500) + size = (0, 0) + title = 'piker chart (ur symbol is loading bby)' def __init__(self, parent=None): super().__init__(parent) - self.setMinimumSize(*self.size) + # self.setMinimumSize(*self.size) self.setWindowTitle(self.title) self._status_bar: QStatusBar = None