From 2b268346541594b55e8ca302e5046a33fed975d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Thu, 14 Nov 2024 00:08:24 +0100 Subject: [PATCH] Auto-resize new qube window to screen size --- qubes_config/new_qube/new_qube_app.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qubes_config/new_qube/new_qube_app.py b/qubes_config/new_qube/new_qube_app.py index 52ca6687..72a7bf69 100644 --- a/qubes_config/new_qube/new_qube_app.py +++ b/qubes_config/new_qube/new_qube_app.py @@ -81,6 +81,20 @@ def do_activate(self, *args, **kwargs): self.perform_setup() assert self.main_window self.main_window.show() + if self.main_window.get_allocated_width() > \ + self.main_window.get_screen().get_width(): + width = int(self.main_window.get_screen().get_width() * 0.9) + else: + # try to have at least 1100 pixels + width = min(int(self.main_window.get_screen().get_width() * 0.9), + 800) + if self.main_window.get_allocated_height() > \ + self.main_window.get_screen().get_height() * 0.9: + height = int(self.main_window.get_screen().get_height() * 0.9) + else: + height = self.main_window.get_allocated_height() + self.main_window.resize(width, height) + self.hold() def perform_setup(self):