pragma Singleton import Quickshell import Quickshell.Io // Read-only user config for ebar. Reads ~/.config/ebar/config.json if it exists and // live-reloads on external edits. If the file is missing, the JsonAdapter defaults below // are used as-is. This singleton never writes to disk or creates directories. Singleton { id: config readonly property string configHome: { const x = Quickshell.env("XDG_CONFIG_HOME") return (x && x.length) ? x : Quickshell.env("HOME") + "/.config" } // Ordered widget lists per bar section. Names resolve via Bar.widgetFor(). property alias leftWidgets: adapter.leftWidgets property alias centerWidgets: adapter.centerWidgets property alias rightWidgets: adapter.rightWidgets // Optional semantic color overrides from config.json. Missing keys use the // defaults below, so a theme can override only the colors it needs. property alias theme: adapter.theme readonly property var defaultTheme: ({ background: "#000000", foreground: "#ffffff", muted: "#888888", disabled: "#555555", surface: "#1a1a1a", hover: "#2a2a2a", focus: "#555555", focusBorder: "#888888", separator: "#333333", secondaryText: "#b0b0b0", accent: "#c08030", accentBackground: "#3a2a10", positive: "#70c070", negative: "#e06060", transparent: "#00000000" }) function color(name) { var value = theme ? theme[name] : undefined return value !== undefined && value !== null && value !== "" ? value : defaultTheme[name] } FileView { id: file path: config.configHome + "/ebar/config.json" watchChanges: true onFileChanged: reload() JsonAdapter { id: adapter property var leftWidgets: ["niriWindows"] property var centerWidgets: [] property var rightWidgets: ["idleInhibit", "audio", "tray", "clock"] property var theme: ({}) } } }