diff --git a/src/apprt/gtk/App.zig b/src/apprt/gtk/App.zig index b70cae258..cc7dac1c4 100644 --- a/src/apprt/gtk/App.zig +++ b/src/apprt/gtk/App.zig @@ -58,9 +58,6 @@ running: bool = true, pub fn init(core_app: *CoreApp, opts: Options) !App { _ = opts; - // Initialize libadwaita - if (build_options.libadwaita) c.adw_init(); - // Load our configuration var config = try Config.load(core_app.alloc); errdefer config.deinit(); @@ -72,8 +69,10 @@ pub fn init(core_app: *CoreApp, opts: Options) !App { } } - // Set the style based on our configuration file - if (build_options.libadwaita) { + // Initialize libadwaita + if (build_options.libadwaita and config.@"gtk-adwaita") { + log.debug("initializing libadwaita", .{}); + c.adw_init(); c.adw_style_manager_set_color_scheme( c.adw_style_manager_get_default(), switch (config.@"window-theme") { diff --git a/src/config/Config.zig b/src/config/Config.zig index 5b84414f3..82e09eb66 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -626,6 +626,20 @@ keybind: Keybinds = .{}, /// which is the old style. @"gtk-wide-tabs": bool = true, +/// If true (default), Ghostty will enable libadwaita theme support. This +/// will make `window-theme` work properly and will also allow Ghostty to +/// properly respond to system theme changes, light/dark mode changing, etc. +/// This requires a GTK4 desktop with a GTK4 theme. +/// +/// If you are running GTK3 or have a GTK3 theme, you may have to set this +/// to false to get your theme picked up properly. Having this set to true +/// with GTK3 should not cause any problems, but it may not work exactly as +/// expected. +/// +/// This configuration only has an effect if Ghostty was built with +/// libadwaita support. +@"gtk-adwaita": bool = true, + /// This will be used to set the TERM environment variable. /// HACK: We set this with an "xterm" prefix because vim uses that to enable key /// protocols (specifically this will enable 'modifyOtherKeys'), among other