diff --git a/scripts/stoa-dfm/dfm/ui/window_config_page_fields.py b/scripts/stoa-dfm/dfm/ui/window_config_page_fields.py index dcce960..3beb741 100644 --- a/scripts/stoa-dfm/dfm/ui/window_config_page_fields.py +++ b/scripts/stoa-dfm/dfm/ui/window_config_page_fields.py @@ -3,12 +3,18 @@ import gi gi.require_version("Gtk", "4.0") gi.require_version("Adw", "1") -from gi.repository import Gtk, Adw, Gdk +from gi.repository import Gtk, Adw, Gdk, GLib from dfm.core.parser import ConfigField, FieldType, ParsedConfig, BOOL_TRUE from dfm.core.scanner import DotfileEntry +def _esc(text: str) -> str: + # Adw row titles/subtitles parse Pango markup; escape user-supplied + # text from config files so '&' and '<' don't blow up the parser. + return GLib.markup_escape_text(text or "") + + def auto_range(key: str, current_val: float) -> tuple[float, float, float]: """Pick a reasonable (lo, hi, step) for a numeric key.""" key_lower = key.lower() @@ -43,9 +49,9 @@ def create_field_row(builder, field: ConfigField, parsed: ParsedConfig, entry: DotfileEntry) -> Adw.ActionRow | None: """Create a row widget appropriate for the field's type.""" ftype = field.field_type if hasattr(field, "field_type") else getattr(field, "type", None) - key = field.key + key = _esc(field.key) value = field.value - description = getattr(field, "comment", "") or "" + description = _esc(getattr(field, "comment", "") or "") if ftype == FieldType.COMMENT: return None diff --git a/scripts/stoa-dfm/dfm/ui/window_config_page_sections.py b/scripts/stoa-dfm/dfm/ui/window_config_page_sections.py index 8a9dcb1..89617b4 100644 --- a/scripts/stoa-dfm/dfm/ui/window_config_page_sections.py +++ b/scripts/stoa-dfm/dfm/ui/window_config_page_sections.py @@ -204,7 +204,7 @@ def build_deps(entry: DotfileEntry) -> Gtk.Widget | None: def build_notes(builder, entry: DotfileEntry) -> Gtk.Widget: - group = Adw.PreferencesGroup(title="Notes & Tags") + group = Adw.PreferencesGroup(title="Notes & Tags") note = get_note(entry.name) note_text = note.note if note else "" diff --git a/theme/gtk-4.0/settings.ini b/theme/gtk-4.0/settings.ini index 316fe17..b42045d 100644 --- a/theme/gtk-4.0/settings.ini +++ b/theme/gtk-4.0/settings.ini @@ -9,4 +9,8 @@ gtk-icon-theme-name = Colloid-dark gtk-cursor-theme-name = Colloid-cursors gtk-cursor-theme-size = 24 gtk-font-name = EB Garamond 11 -gtk-application-prefer-dark-theme = true +# Dark mode for GTK4 / libadwaita is driven by +# org.gnome.desktop.interface color-scheme = 'prefer-dark', set by +# theme/pacman-hooks/stoa-theme-enforce. The legacy +# gtk-application-prefer-dark-theme key is unsupported under libadwaita +# (emits an Adwaita-WARNING on every app launch) and was removed.