aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Langridge <sil@kryogenix.org>2023-08-13 12:07:41 +0100
committerGitHub <noreply@github.com>2023-08-13 12:07:41 +0100
commit41065b3d43be394582b4fbf7f1853ee5928169ee (patch)
tree62e1e5f440940758d2c2749c044ffdb2ab1a77d3
parentMerge pull request #12 from srinivas32/master (diff)
parentuse env var GTK_CSD (diff)
downloadmagnus-41065b3d43be394582b4fbf7f1853ee5928169ee.tar.gz
magnus-41065b3d43be394582b4fbf7f1853ee5928169ee.tar.bz2
magnus-41065b3d43be394582b4fbf7f1853ee5928169ee.zip
Merge pull request #26 from bgstack15/use_gtk_csd_pref
use env var GTK_CSD
-rwxr-xr-xmagnus31
1 files changed, 23 insertions, 8 deletions
diff --git a/magnus b/magnus
index 298c702..c12bcaa 100755
--- a/magnus
+++ b/magnus
@@ -119,12 +119,6 @@ class Main(object):
devman = self.w.get_screen().get_display().get_device_manager()
self.pointer = devman.get_client_pointer()
- # the headerbar
- head = Gtk.HeaderBar()
- head.set_show_close_button(True)
- head.props.title = "Magnus"
- self.w.set_titlebar(head)
-
# the zoom chooser
zoom = Gtk.ComboBoxText.new()
self.zoom = zoom
@@ -132,13 +126,34 @@ class Main(object):
zoom.append(str(i), "{}×".format(i))
zoom.set_active(0)
zoom.connect("changed", self.set_zoom)
- head.pack_end(zoom)
# the box that contains everything
self.img = Gtk.Image()
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(self.img)
- self.w.add(scrolled_window)
+
+ # headerbar or no csd
+ use_headerbar = True
+ if "GTK_CSD" in os.environ:
+ gtk_csd = os.environ.get("GTK_CSD")
+ if gtk_csd == "0" or gtk_csd == "no" or gtk_csd == "":
+ use_headerbar = False
+ if use_headerbar:
+ # the headerbar
+ head = Gtk.HeaderBar()
+ head.set_show_close_button(True)
+ head.props.title = "Magnus"
+ self.w.set_titlebar(head)
+ head.pack_end(zoom)
+ self.w.add(scrolled_window)
+ else:
+ # use regular assets
+ scrolled_window.set_hexpand(True)
+ scrolled_window.set_vexpand(True)
+ grid = Gtk.Grid(column_homogeneous=False)
+ grid.add(zoom)
+ grid.attach(scrolled_window,0,1,4,4)
+ self.w.add(grid)
# bind the zoom keyboard shortcuts
Keybinder.init()
bgstack15