From 203dda40e9e667494a4530aeaad0e360f3f514ef Mon Sep 17 00:00:00 2001 From: alexandropaul Date: Wed, 15 Jul 2026 08:39:18 +0200 Subject: [PATCH 1/5] build: set the install rpath to the prefix libdir --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 5c62fec..f2e308d 100644 --- a/meson.build +++ b/meson.build @@ -58,7 +58,8 @@ executable('singularity-leafs', dependencies: [gtk_dep, gee_dep, vte_dep, json_dep, libsingularity_dep, meson.get_compiler('c').find_library('m', required: true)], vala_args: ['--pkg=posix'] + develop_vala_args, - install: true + install: true, + install_rpath: get_option('prefix') / get_option('libdir') ) desktop_conf = configuration_data() From da0dee10e5bfc43a5f33854140e4a4b5633f5f48 Mon Sep 17 00:00:00 2001 From: alexandropaul Date: Wed, 15 Jul 2026 08:39:28 +0200 Subject: [PATCH 2/5] fix: apply the standalone appearance preference across the app --- src/app.vala | 56 ++++++++++++++++++++++++++- src/leaf_pane.vala | 95 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 148 insertions(+), 3 deletions(-) diff --git a/src/app.vala b/src/app.vala index 5bce1c1..f1a9c54 100644 --- a/src/app.vala +++ b/src/app.vala @@ -123,7 +123,10 @@ namespace Singularity.Apps { settings.changed["font-family"].connect ((_k) => apply_settings_to_all ()); settings.changed["color-scheme"].connect ((_k) => apply_settings_to_all ()); settings.changed["scrollback-lines"].connect ((_k) => apply_settings_to_all ()); - settings.changed["appearance"].connect ((_k) => set_app_appearance (settings.get_string ("appearance"))); + settings.changed["appearance"].connect ((_k) => { + set_app_appearance (settings.get_string ("appearance")); + apply_settings_to_all (); + }); // When "auto" theme is active, re-apply whenever system accent or dark-mode changes desktop_settings = Singularity.Core.safe_settings ("dev.sinty.desktop"); @@ -140,6 +143,8 @@ namespace Singularity.Apps { Singularity.Style.ThemeMode.get_default ().changed.connect (() => { if (settings.get_string ("color-scheme") == "auto") apply_settings_to_all (); + if (settings.get_string ("appearance") == "system") + set_app_appearance ("system"); }); Singularity.Style.StyleManager.get_default ().notify["accent-hex"].connect (() => { if (settings.get_string ("color-scheme") == "auto") @@ -670,6 +675,19 @@ namespace Singularity.Apps { return "system"; } + // Force the app's light/dark chrome when running outside the desktop. + // "system" follows the platform preference; "light"/"dark" override it. + private void set_app_appearance (string appearance) { + bool dark; + switch (appearance) { + case "light": dark = false; break; + case "dark": dark = true; break; + default: dark = Singularity.Style.ThemeMode.get_default ().app_dark (); break; + } + Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = dark; + Singularity.Style.StyleManager.get_default ().apply_color_scheme (dark); + } + private void apply_settings_to_all () { foreach (var leaf in leaves) leaf.apply_settings (settings); @@ -886,9 +904,11 @@ namespace Singularity.Apps { private void setup_styles () { var provider = new Gtk.CssProvider (); provider.load_from_data (LEAFS_CSS.data); + // Above libsingularity's theme (PRIORITY_USER) so app-specific + // overrides actually win over the framework's styling. Gtk.StyleContext.add_provider_for_display ( Gdk.Display.get_default (), provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + Gtk.STYLE_PROVIDER_PRIORITY_USER + 2); } private const string LEAFS_CSS = """ @@ -915,6 +935,38 @@ namespace Singularity.Apps { /* Terminal App */ .term-pane-focused {} .term-pane-unfocused {} + /* Pane hover controls stay dark in every appearance so their + white icons keep contrast over a light terminal too. */ + .singularity-hover-btn, + button.singularity-hover-btn, + button.flat.singularity-hover-btn { + background-image: none; + background-color: rgba(38, 38, 38, 0.92); + border-color: alpha(white, 0.18); + color: white; + } + .singularity-hover-btn image, + button.singularity-hover-btn image, + button.flat.singularity-hover-btn image { + color: white; + } + .singularity-hover-btn:hover, + button.singularity-hover-btn:hover, + button.flat.singularity-hover-btn:hover { + background-image: none; + background-color: rgba(20, 20, 20, 0.96); + border-color: alpha(white, 0.28); + } + /* The Theme selector's revealed list must follow the app theme so + it doesn't sit on a dark surface while the window is light. */ + .expander-content, + .expander-content scrolledwindow, + .expander-content scrolledwindow > viewport, + .expander-content listbox, + .expander-content list, + .expander-content list > row { + background-color: transparent; + } .ssh-sidebar { border-right: 1px solid alpha(@text_color, 0.08); min-width: 200px; diff --git a/src/leaf_pane.vala b/src/leaf_pane.vala index cb2e77e..b93f137 100644 --- a/src/leaf_pane.vala +++ b/src/leaf_pane.vala @@ -327,7 +327,10 @@ namespace Singularity.Apps { vte.set_font (font_desc); vte.set_scrollback_lines (s.get_int ("scrollback-lines")); - var theme = Singularity.Core.TerminalThemes.get_by_id (s.get_string ("color-scheme")); + string scheme = s.get_string ("color-scheme"); + var theme = (scheme == "auto") + ? auto_theme (appearance_is_dark (s)) + : Singularity.Core.TerminalThemes.get_by_id (scheme); if (theme == null) theme = Singularity.Core.TerminalThemes.get_by_id ("onedark"); if (theme != null) { @@ -343,6 +346,96 @@ namespace Singularity.Apps { } } + // Whether the "auto" terminal scheme should render dark. Follows the + // app's own appearance preference so a forced light/dark reaches the + // terminal even when running outside the Singularity shell (where the + // desktop-wide theme mode does not apply). + private bool appearance_is_dark (GLib.Settings s) { + switch (s.get_string ("appearance")) { + case "light": return false; + case "dark": return true; + default: return Singularity.Style.ThemeMode.get_default ().app_dark (); + } + } + + // Accent-tinted "auto" terminal theme. Mirrors libsingularity's + // TerminalThemes.make_auto_theme (), but keyed off the app appearance + // rather than the desktop theme mode. + private static Singularity.Widgets.ColorTheme auto_theme (bool dark) { + string accent = accent_hex (); + if (dark) { + return new Singularity.Widgets.ColorTheme ( + "auto", "Auto (Accent Color)", + tint_bg (accent), "#e8e8e8", + { + "#2a2a2a", "#f38ba8", "#a6e3a1", "#f9e2af", + accent, "#cba6f7", "#89dceb", "#cccccc", + "#555555", "#ff7f9f", "#b8f0bb", "#ffe0a0", + lighten (accent), "#d8b4ff", "#9aeaf7", "#ffffff" + } + ); + } + return new Singularity.Widgets.ColorTheme ( + "auto", "Auto (Accent Color)", + tint_bg_light (accent), "#1a1a1a", + { + "#f0f0f0", "#c0392b", "#27ae60", "#d68910", + accent, "#8e44ad", "#16a085", "#555555", + "#aaaaaa", "#e74c3c", "#2ecc71", "#f1c40f", + darken (accent), "#9b59b6", "#1abc9c", "#1a1a1a" + } + ); + } + + private static string accent_hex () { + string hex = Singularity.Style.StyleManager.get_default ().accent_hex; + return (hex != "") ? hex : "#3584e4"; + } + + private static string tint_bg (string hex) { + if (hex.length < 7) return "#0e0e0e"; + int r = (int) hex.substring (1, 2).to_long (null, 16); + int g = (int) hex.substring (3, 2).to_long (null, 16); + int b = (int) hex.substring (5, 2).to_long (null, 16); + return "#%02x%02x%02x".printf ( + ((int)(0x0d + r * 0.18)).clamp (0, 255), + ((int)(0x0d + g * 0.18)).clamp (0, 255), + ((int)(0x0d + b * 0.18)).clamp (0, 255)); + } + + private static string tint_bg_light (string hex) { + if (hex.length < 7) return "#f5f5f5"; + int r = (int) hex.substring (1, 2).to_long (null, 16); + int g = (int) hex.substring (3, 2).to_long (null, 16); + int b = (int) hex.substring (5, 2).to_long (null, 16); + return "#%02x%02x%02x".printf ( + ((int)(0xf5 - (255 - r) * 0.08)).clamp (0, 255), + ((int)(0xf5 - (255 - g) * 0.08)).clamp (0, 255), + ((int)(0xf5 - (255 - b) * 0.08)).clamp (0, 255)); + } + + private static string darken (string hex) { + if (hex.length < 7) return "#555555"; + int r = (int) hex.substring (1, 2).to_long (null, 16); + int g = (int) hex.substring (3, 2).to_long (null, 16); + int b = (int) hex.substring (5, 2).to_long (null, 16); + return "#%02x%02x%02x".printf ( + ((int)(r * 0.80)).clamp (0, 255), + ((int)(g * 0.80)).clamp (0, 255), + ((int)(b * 0.80)).clamp (0, 255)); + } + + private static string lighten (string hex) { + if (hex.length < 7) return "#aaaaaa"; + int r = (int) hex.substring (1, 2).to_long (null, 16); + int g = (int) hex.substring (3, 2).to_long (null, 16); + int b = (int) hex.substring (5, 2).to_long (null, 16); + return "#%02x%02x%02x".printf ( + (r + (int)((255 - r) * 0.40)).clamp (0, 255), + (g + (int)((255 - g) * 0.40)).clamp (0, 255), + (b + (int)((255 - b) * 0.40)).clamp (0, 255)); + } + private void _spawn_bug () { _bug_counter++; string bug_id = "bug-%d".printf (_bug_counter); From 9d803af556e3f89ee5a6749c75ba648c0475bcc1 Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Wed, 15 Jul 2026 10:30:51 +0200 Subject: [PATCH 3/5] fix: reuse libsingularity for appearance and the auto terminal theme --- src/app.vala | 49 +-------------------------- src/leaf_pane.vala | 84 +--------------------------------------------- 2 files changed, 2 insertions(+), 131 deletions(-) diff --git a/src/app.vala b/src/app.vala index f1a9c54..ee04971 100644 --- a/src/app.vala +++ b/src/app.vala @@ -675,19 +675,6 @@ namespace Singularity.Apps { return "system"; } - // Force the app's light/dark chrome when running outside the desktop. - // "system" follows the platform preference; "light"/"dark" override it. - private void set_app_appearance (string appearance) { - bool dark; - switch (appearance) { - case "light": dark = false; break; - case "dark": dark = true; break; - default: dark = Singularity.Style.ThemeMode.get_default ().app_dark (); break; - } - Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = dark; - Singularity.Style.StyleManager.get_default ().apply_color_scheme (dark); - } - private void apply_settings_to_all () { foreach (var leaf in leaves) leaf.apply_settings (settings); @@ -904,11 +891,9 @@ namespace Singularity.Apps { private void setup_styles () { var provider = new Gtk.CssProvider (); provider.load_from_data (LEAFS_CSS.data); - // Above libsingularity's theme (PRIORITY_USER) so app-specific - // overrides actually win over the framework's styling. Gtk.StyleContext.add_provider_for_display ( Gdk.Display.get_default (), provider, - Gtk.STYLE_PROVIDER_PRIORITY_USER + 2); + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); } private const string LEAFS_CSS = """ @@ -935,38 +920,6 @@ namespace Singularity.Apps { /* Terminal App */ .term-pane-focused {} .term-pane-unfocused {} - /* Pane hover controls stay dark in every appearance so their - white icons keep contrast over a light terminal too. */ - .singularity-hover-btn, - button.singularity-hover-btn, - button.flat.singularity-hover-btn { - background-image: none; - background-color: rgba(38, 38, 38, 0.92); - border-color: alpha(white, 0.18); - color: white; - } - .singularity-hover-btn image, - button.singularity-hover-btn image, - button.flat.singularity-hover-btn image { - color: white; - } - .singularity-hover-btn:hover, - button.singularity-hover-btn:hover, - button.flat.singularity-hover-btn:hover { - background-image: none; - background-color: rgba(20, 20, 20, 0.96); - border-color: alpha(white, 0.28); - } - /* The Theme selector's revealed list must follow the app theme so - it doesn't sit on a dark surface while the window is light. */ - .expander-content, - .expander-content scrolledwindow, - .expander-content scrolledwindow > viewport, - .expander-content listbox, - .expander-content list, - .expander-content list > row { - background-color: transparent; - } .ssh-sidebar { border-right: 1px solid alpha(@text_color, 0.08); min-width: 200px; diff --git a/src/leaf_pane.vala b/src/leaf_pane.vala index b93f137..10f053d 100644 --- a/src/leaf_pane.vala +++ b/src/leaf_pane.vala @@ -329,7 +329,7 @@ namespace Singularity.Apps { string scheme = s.get_string ("color-scheme"); var theme = (scheme == "auto") - ? auto_theme (appearance_is_dark (s)) + ? Singularity.Core.TerminalThemes.make_auto_theme (appearance_is_dark (s)) : Singularity.Core.TerminalThemes.get_by_id (scheme); if (theme == null) theme = Singularity.Core.TerminalThemes.get_by_id ("onedark"); @@ -346,10 +346,6 @@ namespace Singularity.Apps { } } - // Whether the "auto" terminal scheme should render dark. Follows the - // app's own appearance preference so a forced light/dark reaches the - // terminal even when running outside the Singularity shell (where the - // desktop-wide theme mode does not apply). private bool appearance_is_dark (GLib.Settings s) { switch (s.get_string ("appearance")) { case "light": return false; @@ -358,84 +354,6 @@ namespace Singularity.Apps { } } - // Accent-tinted "auto" terminal theme. Mirrors libsingularity's - // TerminalThemes.make_auto_theme (), but keyed off the app appearance - // rather than the desktop theme mode. - private static Singularity.Widgets.ColorTheme auto_theme (bool dark) { - string accent = accent_hex (); - if (dark) { - return new Singularity.Widgets.ColorTheme ( - "auto", "Auto (Accent Color)", - tint_bg (accent), "#e8e8e8", - { - "#2a2a2a", "#f38ba8", "#a6e3a1", "#f9e2af", - accent, "#cba6f7", "#89dceb", "#cccccc", - "#555555", "#ff7f9f", "#b8f0bb", "#ffe0a0", - lighten (accent), "#d8b4ff", "#9aeaf7", "#ffffff" - } - ); - } - return new Singularity.Widgets.ColorTheme ( - "auto", "Auto (Accent Color)", - tint_bg_light (accent), "#1a1a1a", - { - "#f0f0f0", "#c0392b", "#27ae60", "#d68910", - accent, "#8e44ad", "#16a085", "#555555", - "#aaaaaa", "#e74c3c", "#2ecc71", "#f1c40f", - darken (accent), "#9b59b6", "#1abc9c", "#1a1a1a" - } - ); - } - - private static string accent_hex () { - string hex = Singularity.Style.StyleManager.get_default ().accent_hex; - return (hex != "") ? hex : "#3584e4"; - } - - private static string tint_bg (string hex) { - if (hex.length < 7) return "#0e0e0e"; - int r = (int) hex.substring (1, 2).to_long (null, 16); - int g = (int) hex.substring (3, 2).to_long (null, 16); - int b = (int) hex.substring (5, 2).to_long (null, 16); - return "#%02x%02x%02x".printf ( - ((int)(0x0d + r * 0.18)).clamp (0, 255), - ((int)(0x0d + g * 0.18)).clamp (0, 255), - ((int)(0x0d + b * 0.18)).clamp (0, 255)); - } - - private static string tint_bg_light (string hex) { - if (hex.length < 7) return "#f5f5f5"; - int r = (int) hex.substring (1, 2).to_long (null, 16); - int g = (int) hex.substring (3, 2).to_long (null, 16); - int b = (int) hex.substring (5, 2).to_long (null, 16); - return "#%02x%02x%02x".printf ( - ((int)(0xf5 - (255 - r) * 0.08)).clamp (0, 255), - ((int)(0xf5 - (255 - g) * 0.08)).clamp (0, 255), - ((int)(0xf5 - (255 - b) * 0.08)).clamp (0, 255)); - } - - private static string darken (string hex) { - if (hex.length < 7) return "#555555"; - int r = (int) hex.substring (1, 2).to_long (null, 16); - int g = (int) hex.substring (3, 2).to_long (null, 16); - int b = (int) hex.substring (5, 2).to_long (null, 16); - return "#%02x%02x%02x".printf ( - ((int)(r * 0.80)).clamp (0, 255), - ((int)(g * 0.80)).clamp (0, 255), - ((int)(b * 0.80)).clamp (0, 255)); - } - - private static string lighten (string hex) { - if (hex.length < 7) return "#aaaaaa"; - int r = (int) hex.substring (1, 2).to_long (null, 16); - int g = (int) hex.substring (3, 2).to_long (null, 16); - int b = (int) hex.substring (5, 2).to_long (null, 16); - return "#%02x%02x%02x".printf ( - (r + (int)((255 - r) * 0.40)).clamp (0, 255), - (g + (int)((255 - g) * 0.40)).clamp (0, 255), - (b + (int)((255 - b) * 0.40)).clamp (0, 255)); - } - private void _spawn_bug () { _bug_counter++; string bug_id = "bug-%d".printf (_bug_counter); From 7e9502f8993749e98d47ad07813614f11e80d901 Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Wed, 15 Jul 2026 11:16:49 +0200 Subject: [PATCH 4/5] fix: make the window chrome follow the terminal theme --- data/dev.sinty.leafs.gschema.xml | 10 ----- src/app.vala | 66 ++++++++++++++++++++------------ src/leaf_pane.vala | 10 ++--- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/data/dev.sinty.leafs.gschema.xml b/data/dev.sinty.leafs.gschema.xml index 8c8d47a..86f4fa2 100644 --- a/data/dev.sinty.leafs.gschema.xml +++ b/data/dev.sinty.leafs.gschema.xml @@ -36,15 +36,5 @@ Saved blooms (JSON) List of registered bloom commands as JSON strings (label, command). - - - - - - - "system" - Appearance - Window appearance when running outside the Singularity desktop: follow the system, or force light or dark. - diff --git a/src/app.vala b/src/app.vala index ee04971..b4a6c0f 100644 --- a/src/app.vala +++ b/src/app.vala @@ -121,12 +121,8 @@ namespace Singularity.Apps { // React to font/theme changes live settings.changed["font-size"].connect ((_k) => apply_settings_to_all ()); settings.changed["font-family"].connect ((_k) => apply_settings_to_all ()); - settings.changed["color-scheme"].connect ((_k) => apply_settings_to_all ()); + settings.changed["color-scheme"].connect ((_k) => sync_terminal_theme ()); settings.changed["scrollback-lines"].connect ((_k) => apply_settings_to_all ()); - settings.changed["appearance"].connect ((_k) => { - set_app_appearance (settings.get_string ("appearance")); - apply_settings_to_all (); - }); // When "auto" theme is active, re-apply whenever system accent or dark-mode changes desktop_settings = Singularity.Core.safe_settings ("dev.sinty.desktop"); @@ -141,17 +137,16 @@ namespace Singularity.Apps { }); } Singularity.Style.ThemeMode.get_default ().changed.connect (() => { + sync_window_chrome (); if (settings.get_string ("color-scheme") == "auto") apply_settings_to_all (); - if (settings.get_string ("appearance") == "system") - set_app_appearance ("system"); }); Singularity.Style.StyleManager.get_default ().notify["accent-hex"].connect (() => { if (settings.get_string ("color-scheme") == "auto") apply_settings_to_all (); }); - set_app_appearance (settings.get_string ("appearance")); + sync_window_chrome (); } protected override void activate () { @@ -643,15 +638,25 @@ namespace Singularity.Apps { if (prefs_win != null) { prefs_win.present (); return; } var page = new Singularity.Widgets.PreferencesPage (); - var group = new Singularity.Widgets.PreferencesGroup (_("Appearance")); + var group = new Singularity.Widgets.PreferencesGroup (_("Terminal")); + + var themes = Singularity.Core.TerminalThemes.get_all (); + string[] names = {}; + foreach (var t in themes) names += t.name; + string current = settings.get_string ("color-scheme"); + string current_name = ""; + foreach (var t in themes) + if (t.id == current) current_name = t.name; - var theme_row = new Singularity.Widgets.SelectionRow (_("Theme"), - { _("System"), _("Light"), _("Dark") }, - appearance_label (settings.get_string ("appearance"))); + var theme_row = new Singularity.Widgets.SelectionRow (_("Theme"), names, current_name); theme_row.selected.connect ((item) => { - string tok = appearance_token (item); - if (settings.get_string ("appearance") != tok) - settings.set_string ("appearance", tok); + foreach (var t in themes) { + if (t.name == item) { + if (settings.get_string ("color-scheme") != t.id) + settings.set_string ("color-scheme", t.id); + break; + } + } }); group.add_row (theme_row); page.append_group (group); @@ -661,21 +666,32 @@ namespace Singularity.Apps { prefs_win.present (); } - private string appearance_label (string tok) { - switch (tok) { - case "light": return _("Light"); - case "dark": return _("Dark"); - default: return _("System"); - } + + private bool terminal_is_dark () { + string scheme = settings.get_string ("color-scheme"); + if (scheme == "auto") + return Singularity.Style.ThemeMode.get_default ().app_dark (); + var theme = Singularity.Core.TerminalThemes.get_by_id (scheme); + if (theme == null) + theme = Singularity.Core.TerminalThemes.get_by_id ("onedark"); + return theme != null + && Singularity.Core.TerminalThemes.is_dark_background (theme.background); } - private string appearance_token (string label) { - if (label == _("Light")) return "light"; - if (label == _("Dark")) return "dark"; - return "system"; + private void sync_window_chrome () { + bool dark = terminal_is_dark (); + Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = dark; + Singularity.Style.StyleManager.get_default ().apply_color_scheme (dark); + } + + private void sync_terminal_theme () { + sync_window_chrome (); + apply_settings_to_all (); } private void apply_settings_to_all () { + if (leaves == null) + return; foreach (var leaf in leaves) leaf.apply_settings (settings); } diff --git a/src/leaf_pane.vala b/src/leaf_pane.vala index 10f053d..31c9920 100644 --- a/src/leaf_pane.vala +++ b/src/leaf_pane.vala @@ -329,7 +329,7 @@ namespace Singularity.Apps { string scheme = s.get_string ("color-scheme"); var theme = (scheme == "auto") - ? Singularity.Core.TerminalThemes.make_auto_theme (appearance_is_dark (s)) + ? Singularity.Core.TerminalThemes.make_auto_theme (auto_is_dark ()) : Singularity.Core.TerminalThemes.get_by_id (scheme); if (theme == null) theme = Singularity.Core.TerminalThemes.get_by_id ("onedark"); @@ -346,12 +346,8 @@ namespace Singularity.Apps { } } - private bool appearance_is_dark (GLib.Settings s) { - switch (s.get_string ("appearance")) { - case "light": return false; - case "dark": return true; - default: return Singularity.Style.ThemeMode.get_default ().app_dark (); - } + private bool auto_is_dark () { + return Singularity.Style.ThemeMode.get_default ().app_dark (); } private void _spawn_bug () { From 1d6bfa2cf2a42162914fa0beb6d377cd4b1e01fc Mon Sep 17 00:00:00 2001 From: alexandropaul Date: Fri, 17 Jul 2026 09:31:03 +0200 Subject: [PATCH 5/5] fix: keep leaf hover controls and their popovers readable in light mode --- src/app.vala | 44 ++++++++++++++++++++++---------------------- src/leaf_pane.vala | 12 +++++++----- src/window.vala | 1 + 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/app.vala b/src/app.vala index b4a6c0f..20760bd 100644 --- a/src/app.vala +++ b/src/app.vala @@ -121,7 +121,10 @@ namespace Singularity.Apps { // React to font/theme changes live settings.changed["font-size"].connect ((_k) => apply_settings_to_all ()); settings.changed["font-family"].connect ((_k) => apply_settings_to_all ()); - settings.changed["color-scheme"].connect ((_k) => sync_terminal_theme ()); + settings.changed["color-scheme"].connect ((_k) => { + sync_window_chrome (); + apply_settings_to_all (); + }); settings.changed["scrollback-lines"].connect ((_k) => apply_settings_to_all ()); // When "auto" theme is active, re-apply whenever system accent or dark-mode changes @@ -433,6 +436,7 @@ namespace Singularity.Apps { var popover = new Gtk.Popover (); popover.set_parent (anchor); popover.has_arrow = true; + popover.add_css_class ("context-menu"); var root_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); root_box.set_size_request (290, -1); @@ -667,31 +671,18 @@ namespace Singularity.Apps { } - private bool terminal_is_dark () { - string scheme = settings.get_string ("color-scheme"); - if (scheme == "auto") - return Singularity.Style.ThemeMode.get_default ().app_dark (); - var theme = Singularity.Core.TerminalThemes.get_by_id (scheme); - if (theme == null) - theme = Singularity.Core.TerminalThemes.get_by_id ("onedark"); - return theme != null - && Singularity.Core.TerminalThemes.is_dark_background (theme.background); - } - private void sync_window_chrome () { - bool dark = terminal_is_dark (); + string scheme = settings.get_string ("color-scheme"); + bool dark = scheme == "auto" + ? Singularity.Style.ThemeMode.get_default ().app_dark () + : Singularity.Core.TerminalThemes.is_dark_background ( + (Singularity.Core.TerminalThemes.get_by_id (scheme) + ?? Singularity.Core.TerminalThemes.get_by_id ("onedark")).background); Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = dark; Singularity.Style.StyleManager.get_default ().apply_color_scheme (dark); } - private void sync_terminal_theme () { - sync_window_chrome (); - apply_settings_to_all (); - } - private void apply_settings_to_all () { - if (leaves == null) - return; foreach (var leaf in leaves) leaf.apply_settings (settings); } @@ -789,6 +780,7 @@ namespace Singularity.Apps { var popover = new Gtk.Popover (); popover.set_parent (anchor); popover.has_arrow = true; + popover.add_css_class ("context-menu"); var root_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); root_box.set_size_request (290, -1); @@ -909,7 +901,7 @@ namespace Singularity.Apps { provider.load_from_data (LEAFS_CSS.data); Gtk.StyleContext.add_provider_for_display ( Gdk.Display.get_default (), provider, - Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + Gtk.STYLE_PROVIDER_PRIORITY_USER + 1); } private const string LEAFS_CSS = """ @@ -1030,7 +1022,15 @@ namespace Singularity.Apps { .bloom-terminal { padding: 30px 12px 8px 12px; } - """; + /* Hover buttons force a white icon/label color (library CSS); stop + it from inheriting into popovers anchored on them (GTK4 popovers + are style-tree children of their anchor). */ + .leafs-window popover.context-menu, + .leafs-window popover.context-menu > contents, + .leafs-window popover.context-menu * { + color: @text_color; + } + """; } } diff --git a/src/leaf_pane.vala b/src/leaf_pane.vala index 31c9920..72a97db 100644 --- a/src/leaf_pane.vala +++ b/src/leaf_pane.vala @@ -160,6 +160,7 @@ namespace Singularity.Apps { hover_controls.add_control (grip_btn); var add_btn = new Button.from_icon_name ("list-add-symbolic"); + add_btn.add_css_class ("flat"); add_btn.tooltip_text = _("New leaf / bug"); add_btn.clicked.connect (() => { _add_menu = new Singularity.Widgets.ContextMenu (add_btn); @@ -177,19 +178,23 @@ namespace Singularity.Apps { hover_controls.add_control (add_btn); ssh_btn = new Button.from_icon_name ("network-server-symbolic"); + ssh_btn.add_css_class ("flat"); ssh_btn.tooltip_text = _("SSH Sessions"); hover_controls.add_control (ssh_btn); bloom_btn = new Button.from_icon_name ("window-restore-symbolic"); + bloom_btn.add_css_class ("flat"); bloom_btn.tooltip_text = _("Blooms"); hover_controls.add_control (bloom_btn); var settings_btn = new Button.from_icon_name ("emblem-system-symbolic"); + settings_btn.add_css_class ("flat"); settings_btn.tooltip_text = _("Settings"); settings_btn.clicked.connect (() => settings_requested ()); hover_controls.add_control (settings_btn); var close_btn = new Button.from_icon_name ("window-close-symbolic"); + close_btn.add_css_class ("flat"); close_btn.tooltip_text = _("Close"); close_btn.clicked.connect (() => { _close_menu = new Singularity.Widgets.ContextMenu (close_btn); @@ -329,7 +334,8 @@ namespace Singularity.Apps { string scheme = s.get_string ("color-scheme"); var theme = (scheme == "auto") - ? Singularity.Core.TerminalThemes.make_auto_theme (auto_is_dark ()) + ? Singularity.Core.TerminalThemes.make_auto_theme ( + Singularity.Style.ThemeMode.get_default ().app_dark ()) : Singularity.Core.TerminalThemes.get_by_id (scheme); if (theme == null) theme = Singularity.Core.TerminalThemes.get_by_id ("onedark"); @@ -346,10 +352,6 @@ namespace Singularity.Apps { } } - private bool auto_is_dark () { - return Singularity.Style.ThemeMode.get_default ().app_dark (); - } - private void _spawn_bug () { _bug_counter++; string bug_id = "bug-%d".printf (_bug_counter); diff --git a/src/window.vala b/src/window.vala index 728efe8..fdc351e 100644 --- a/src/window.vala +++ b/src/window.vala @@ -15,6 +15,7 @@ namespace Singularity.Apps { public LeafsWindow (Gtk.Application app) { Object (application: app); + add_css_class ("leafs-window"); #if DEVEL set_title (_("Leafs (Devel)")); #else