From 12e5cd217aed1c29c75aff51d3f14523529823d5 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sat, 12 Aug 2023 13:40:26 -0400 Subject: use env var GTK_CSD --- magnus | 31 +++++++++++++++++++++++-------- 1 file 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() -- cgit