Skip to content

Commit

Permalink
Fixing policy editor window size on 1024x168 displays
Browse files Browse the repository at this point in the history
Also improving Window size on other display sizes
  • Loading branch information
alimirjamali committed Jul 9, 2024
1 parent 03614c0 commit d2f37e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 3 additions & 4 deletions qubes_config/policy_editor.glade
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
</child>
</object>
<object class="GtkApplicationWindow" id="main_window">
<property name="height-request">700</property>
<property name="can-focus">False</property>
<property name="hexpand">False</property>
<property name="vexpand">False</property>
Expand Down Expand Up @@ -103,7 +102,7 @@
</child>
<child>
<object class="GtkScrolledWindow" id="source_window">
<property name="width-request">800</property>
<property name="width-request">750</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="vexpand">True</property>
Expand Down Expand Up @@ -153,7 +152,7 @@
</child>
<child>
<object class="GtkScrolledWindow" id="help_window">
<property name="width-request">450</property>
<property name="width-request">270</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
Expand All @@ -178,7 +177,7 @@
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
<property name="shrink">False</property>
</packing>
</child>
</object>
Expand Down
10 changes: 10 additions & 0 deletions qubes_config/policy_editor/policy_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ def perform_setup(self):
self.main_window : Gtk.ApplicationWindow = \
self.builder.get_object('main_window')

# Reserving 3 pixels for window border on all sides (most themes use 2)
# Reserving 32x2 pixels for taskbar (default on top) and Window title.
# Setting minimum supported size
self.main_window.set_size_request(1024 - 3*2, 768 - 3*2 - 32*2)
width = min(1920, self.main_window.get_screen().get_width())
height= min(1280, self.main_window.get_screen().get_height())
self.main_window.set_default_size(width - 3*2, height - 3*2 - 32*2)
# ToDo: Considering maximizing by default as it packs too much info.
# self.main_window.maximize()

# setup source and help
header_box: Gtk.Box = self.builder.get_object('header_box')
self.header_view = GtkSource.View()
Expand Down

0 comments on commit d2f37e1

Please sign in to comment.