Merge pull request #878 from mitchellh/adwaita-runtime

apprt/gtk: gtk-adwaita runtime config to configure libadwaita
This commit is contained in:
Mitchell Hashimoto
2023-11-14 08:36:11 -08:00
committed by GitHub
2 changed files with 18 additions and 5 deletions

View File

@ -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") {

View File

@ -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