From a1a48eb3f065c716fd2276ba387fef9f7bbecea8 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Sun, 3 Sep 2023 21:27:21 +0200 Subject: [PATCH] gtk: allow hiding window decoration in configuration This is part of #319 by fixing it for GTK and introducing the configuration option. This adds `window-decoration = false` as a possible configuration option. If set to `false`, then no window decorations are used. --- src/apprt/gtk.zig | 6 ++++++ src/config.zig | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/apprt/gtk.zig b/src/apprt/gtk.zig index 3dd09fb0d..4f11498e4 100644 --- a/src/apprt/gtk.zig +++ b/src/apprt/gtk.zig @@ -354,6 +354,12 @@ const Window = struct { c.gtk_widget_set_opacity(@ptrCast(window), app.config.@"background-opacity"); } + // Hide window decoration if configured. This has to happen before + // `gtk_widget_show`. + if (!app.config.@"window-decoration") { + c.gtk_window_set_decorated(gtk_window, 0); + } + c.gtk_widget_show(window); _ = c.g_signal_connect_data(window, "close-request", c.G_CALLBACK(>kCloseRequest), self, null, G_CONNECT_DEFAULT); _ = c.g_signal_connect_data(window, "destroy", c.G_CALLBACK(>kDestroy), self, null, G_CONNECT_DEFAULT); diff --git a/src/config.zig b/src/config.zig index bd826c5d6..f74aa0b46 100644 --- a/src/config.zig +++ b/src/config.zig @@ -213,6 +213,11 @@ pub const Config = struct { /// specified in the configuration "font-size" will be used. @"window-inherit-font-size": bool = true, + /// If false, windows won't have native decorations, i.e. titlebar and + /// borders. + /// Currently only supported with GTK. + @"window-decoration": bool = true, + /// Whether to allow programs running in the terminal to read/write to /// the system clipboard (OSC 52, for googling). The default is to /// disallow clipboard reading but allow writing.