Consolidate omarchy-shell colors into a single shell.toml surface

Five plugins each owned their own colors.toml watcher with subtly
different parsers, plus two ad-hoc per-theme override files
(notifications.json, image-picker-colors.json). This collapses all of
that into one source of truth: Commons/Color.qml watches colors.toml +
shell.toml and exposes Color.bar.*, Color.popups.*, Color.notifications.*,
Color.menu.*, Color.imagePicker.* for every surface to bind to.

shell.toml is generated by the existing template pipeline from
default/themed/shell.toml.tpl. Themes can ship their own shell.toml to
override individual keys; everything missing falls back to the
foundational palette via root.pick(). Settings panel is intentionally
not themable beyond the foundational tokens.

last-horizon and solitude ship a minimal shell.toml to preserve their
historical 'notification border matches Hyprland active border'
behavior, which previously came from parsing the theme's hyprland.conf
(now removed).
This commit is contained in:
Ryan Hughes
2026-05-16 00:30:27 -04:00
parent 227d32544f
commit f404a81c6a
14 changed files with 199 additions and 298 deletions
+5 -25
View File
@@ -1,12 +1,11 @@
#!/bin/bash #!/bin/bash
# omarchy:summary=Open a generic image selector menu # omarchy:summary=Open a generic image selector menu
# omarchy:args=[--selected <image>] [--colors-file <path>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--cache-only] <image-dir>... # omarchy:args=[--selected <image>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--cache-only] <image-dir>...
OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy} OMARCHY_PATH=${OMARCHY_PATH:-$HOME/.local/share/omarchy}
selected_image="" selected_image=""
colors_file=""
print_name=false print_name=false
show_labels=false show_labels=false
filterable=false filterable=false
@@ -16,7 +15,7 @@ cache_only=false
image_dirs=() image_dirs=()
usage() { usage() {
echo "Usage: omarchy-menu-images [--selected <image>] [--colors-file <path>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--cache-only] <image-dir>..." echo "Usage: omarchy-menu-images [--selected <image>] [--print-name] [--show-labels] [--filterable] [--lazy-thumbnails] [--cache-only] <image-dir>..."
} }
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
@@ -30,15 +29,6 @@ while [[ $# -gt 0 ]]; do
selected_image="$2" selected_image="$2"
shift 2 shift 2
;; ;;
--colors-file)
if (( $# < 2 )); then
usage >&2
exit 1
fi
colors_file="$2"
shift 2
;;
--print-name) --print-name)
print_name=true print_name=true
shift shift
@@ -212,22 +202,14 @@ else
fi fi
fi fi
colors_file=${colors_file:-$HOME/.config/omarchy/current/theme/image-picker-colors.json}
colors_payload=""
if [[ -f $colors_file ]]; then
colors_payload=$(<"$colors_file")
fi
if [[ $cache_only == true || $prepare_only == true ]]; then if [[ $cache_only == true || $prepare_only == true ]]; then
exit 0 exit 0
fi fi
# Image rows and the raw colors blob can contain newlines and tabs, which # Image rows can contain newlines and tabs, which don't survive a positional
# don't survive a positional bash argv into `quickshell ipc call`. Base64 # bash argv into `quickshell ipc call`. Base64-encode for transit; the
# them; the ImagePicker plugin Qt.atob()s on the other side. # ImagePicker plugin Qt.atob()s on the other side.
rows_b64=$(printf '%s' "$rows" | base64 -w 0) rows_b64=$(printf '%s' "$rows" | base64 -w 0)
colors_b64=$(printf '%s' "$colors_payload" | base64 -w 0)
if ! omarchy-shell-ipc image-selector open \ if ! omarchy-shell-ipc image-selector open \
"" \ "" \
@@ -235,8 +217,6 @@ if ! omarchy-shell-ipc image-selector open \
"$selected_list_image" \ "$selected_list_image" \
"$selection_file" \ "$selection_file" \
"$done_file" \ "$done_file" \
"" \
"$colors_b64" \
"$show_labels" \ "$show_labels" \
"$filterable" >/dev/null; then "$filterable" >/dev/null; then
echo "Image selector failed to accept request" >&2 echo "Image selector failed to accept request" >&2
@@ -3,27 +3,63 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
// Noctalia compat shim. Plugins import `qs.Commons` and reach for these // Single source of truth for shell color surfaces. Top-level tokens
// palette tokens / helpers. Values stream from the Omarchy theme file; the // (foreground/background/accent/urgent) come from the theme's colors.toml.
// shell wires this singleton up at startup via setHostBar()/setHostShell(). // Per-surface roles (Color.bar.*, Color.popups.*, Color.notifications.*,
// // Color.menu.*, Color.imagePicker.*) come from shell.toml, which is generated
// We don't try to replicate Noctalia's full Material You resolver — for the // per theme from default/themed/shell.toml.tpl (or shipped directly by a
// fields plugins actually read, a flat token table is enough. // theme to override). Surfaces that don't appear in shell.toml fall back to
// the foundational palette, so themes can ship partial overrides.
QtObject { QtObject {
id: root id: root
// Live updated from theme/colors.toml via the FileView below. // Foundational palette. Live updated from theme/colors.toml.
property color foreground: "#cacccc" property color foreground: "#cacccc"
property color background: "#101315" property color background: "#101315"
property color accent: "#cacccc" property color accent: "#cacccc"
property color urgent: "#a55555" property color urgent: "#a55555"
// The theme's Hyprland active border color (`$activeBorderColor` in the
// theme's hyprland.conf). Most themes set this to the accent; some themes
// (e.g. aether, oodle) override it to a neutral. Streamed from the theme
// file alongside colors.toml so notification surfaces stay in sync.
property color border: accent
// Noctalia palette tokens. We map them onto our theme colors. // Flat dictionary of "section.key" -> "#rrggbb" parsed from shell.toml.
// Reassigning this whole property is what makes surface bindings below
// re-evaluate when the theme swaps; mutating it in place would not.
property var shellValues: ({})
function pick(key, fallback) {
var v = shellValues[key]
return (typeof v === "string" && v.length > 0) ? v : fallback
}
// Surface roles. Each property reads its shell.toml override if set,
// otherwise falls back to a foundational palette token.
readonly property QtObject bar: QtObject {
property color background: root.pick("bar.background", root.background)
property color text: root.pick("bar.text", root.foreground)
property color active: root.pick("bar.active", root.urgent)
}
readonly property QtObject popups: QtObject {
property color background: root.pick("popups.background", root.background)
property color border: root.pick("popups.border", root.foreground)
}
readonly property QtObject notifications: QtObject {
property color background: root.pick("notifications.background", root.background)
property color text: root.pick("notifications.text", root.foreground)
property color border: root.pick("notifications.border", root.accent)
property color countdown: root.pick("notifications.countdown", root.accent)
}
readonly property QtObject menu: QtObject {
property color background: root.pick("menu.background", root.background)
property color text: root.pick("menu.text", root.foreground)
property color selected: root.pick("menu.selected", root.accent)
}
readonly property QtObject imagePicker: QtObject {
property color background: root.pick("image-picker.background", root.background)
property color text: root.pick("image-picker.text", root.foreground)
property color selectedBorder: root.pick("image-picker.selected-border", root.accent)
property color unselectedBorder: root.pick("image-picker.unselected-border", root.foreground)
}
// Noctalia palette tokens used by the compat widgets. Mapped onto the
// foundational palette; not exposed in shell.toml.
readonly property color mPrimary: accent readonly property color mPrimary: accent
readonly property color mSecondary: Qt.darker(accent, 1.2) readonly property color mSecondary: Qt.darker(accent, 1.2)
readonly property color mTertiary: Qt.lighter(accent, 1.3) readonly property color mTertiary: Qt.lighter(accent, 1.3)
@@ -89,12 +125,10 @@ QtObject {
case "urgent": case "urgent":
case "red": return urgent case "red": return urgent
} }
// Anything else, treat as a literal CSS color string (the QML color type
// does this conversion implicitly when assigned).
return Qt.color(k) return Qt.color(k)
} }
function loadTheme(raw) { function loadColors(raw) {
var lines = String(raw || "").split("\n") var lines = String(raw || "").split("\n")
var foundAccent = false var foundAccent = false
var color4Value = "" var color4Value = ""
@@ -114,39 +148,52 @@ QtObject {
if (!foundAccent && color4Value.length > 0) accent = color4Value if (!foundAccent && color4Value.length > 0) accent = color4Value
} }
// Parse `$activeBorderColor = rgb(XXXXXX)` from the theme's hyprland.conf. // Walk shell.toml line-by-line. We only need string values for color keys,
function loadHyprlandTheme(raw) { // and the file is small, so no proper TOML parser. Accepts double- or
var match = String(raw || "").match(/\$activeBorderColor\s*=\s*rgba?\(([0-9A-Fa-f]{6,8})\)/) // single-quoted values and tolerates trailing inline comments.
if (!match) { border = accent; return } function loadShell(raw) {
var hex = match[1] var parsed = {}
// Hyprland rgba() is RRGGBBAA; strip the AA suffix and use RGB. var text = String(raw || "")
if (hex.length === 8) hex = hex.substring(0, 6) if (text) {
border = "#" + hex var lines = text.split("\n")
var section = ""
for (var i = 0; i < lines.length; i++) {
var line = lines[i].replace(/^\s+|\s+$/g, "")
if (!line || line.charAt(0) === "#") continue
var sectionMatch = line.match(/^\[([A-Za-z0-9_-]+)\]\s*(#.*)?$/)
if (sectionMatch) { section = sectionMatch[1]; continue }
var kv = line.match(/^([A-Za-z0-9_-]+)\s*=\s*["']([^"']+)["']\s*(#.*)?$/)
if (!kv || !section) continue
parsed[section + "." + kv[1]] = kv[2]
}
}
shellValues = parsed
} }
// `omarchy-theme-set` recreates the theme/ directory via rm+mv, which kills // `omarchy-theme-set` recreates the theme/ directory via rm+mv, which kills
// the inotify watch on colors.toml. Use theme.name (overwritten in place) as // the inotify watch on colors.toml. Use theme.name (overwritten in place) as
// a tripwire that forces a fresh reload after each swap. // a tripwire that forces a fresh reload after each swap.
property FileView themeFile: FileView { property FileView colorsFile: FileView {
id: themeColorsFile id: colorsFile
path: Quickshell.env("HOME") + "/.config/omarchy/current/theme/colors.toml" path: Quickshell.env("HOME") + "/.config/omarchy/current/theme/colors.toml"
watchChanges: true watchChanges: true
printErrors: false printErrors: false
onLoaded: root.loadTheme(text()) onLoaded: root.loadColors(text())
onFileChanged: reload()
}
property FileView shellFile: FileView {
id: shellFile
path: Quickshell.env("HOME") + "/.config/omarchy/current/theme/shell.toml"
watchChanges: true
printErrors: false
onLoaded: root.loadShell(text())
onLoadFailed: root.loadShell("")
onFileChanged: reload() onFileChanged: reload()
} }
property FileView themeNameFile: FileView { property FileView themeNameFile: FileView {
path: Quickshell.env("HOME") + "/.config/omarchy/current/theme.name" path: Quickshell.env("HOME") + "/.config/omarchy/current/theme.name"
watchChanges: true watchChanges: true
printErrors: false printErrors: false
onFileChanged: { themeColorsFile.reload(); themeHyprlandFile.reload() } onFileChanged: { colorsFile.reload(); shellFile.reload() }
}
property FileView themeHyprlandFile: FileView {
id: themeHyprlandFile
path: Quickshell.env("HOME") + "/.config/omarchy/current/theme/hyprland.conf"
watchChanges: true
printErrors: false
onLoaded: root.loadHyprlandTheme(text())
onFileChanged: reload()
} }
} }
@@ -47,12 +47,13 @@ Two ways to drive it:
- Shell-level summon: `omarchy-shell-ipc shell summon omarchy.image-picker '<jsonPayload>'`. - Shell-level summon: `omarchy-shell-ipc shell summon omarchy.image-picker '<jsonPayload>'`.
The payload can carry `imageDirs`, `imageRows`, `selectedImage`, The payload can carry `imageDirs`, `imageRows`, `selectedImage`,
`selectionFile`, `doneFile`, `colorsFile`, `colorsRaw`, `showLabels`, `selectionFile`, `doneFile`, `showLabels`, `filterable`. Best for
`filterable`. Best for in-shell callers that already speak JSON. in-shell callers that already speak JSON.
- Direct IPC target: `omarchy-shell-ipc image-selector open <imageDirs> <imageRowsB64> <selectedImage> <selectionFile> <doneFile> <colorsFile> <colorsRawB64> <showLabels> <filterable>`. - Direct IPC target: `omarchy-shell-ipc image-selector open <imageDirs> <imageRowsB64> <selectedImage> <selectionFile> <doneFile> <showLabels> <filterable>`.
Positional args; `imageRowsB64` and `colorsRawB64` are base64-encoded so Positional args; `imageRowsB64` is base64-encoded so embedded newlines /
embedded newlines / tabs survive the bash argv handoff. This is what tabs survive the bash argv handoff. This is what `omarchy-menu-images`
`omarchy-menu-images` uses. uses. Colors come from the central shell theme singleton; there is no
per-call override surface.
The selection round-trip remains file-based: callers create a The selection round-trip remains file-based: callers create a
`selection_file` and `done_file` (both `mktemp`), pass the paths, and `selection_file` and `done_file` (both `mktemp`), pass the paths, and
@@ -9,6 +9,7 @@ import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import qs.Commons
import "common" as BarCommon import "common" as BarCommon
Item { Item {
@@ -49,9 +50,11 @@ Item {
// "monospace" resolves through fontconfig at paint time, so changing the // "monospace" resolves through fontconfig at paint time, so changing the
// system font (via `omarchy-font-set`) updates the bar without a reload. // system font (via `omarchy-font-set`) updates the bar without a reload.
property string fontFamily: "monospace" property string fontFamily: "monospace"
property color foreground: "#cacccc" // Bound to the central Color singleton so the bar tracks shell.toml's
property color background: "#101315" // [bar] section. Property names kept for the rest of this file's bindings.
property color urgent: "#a55555" property color foreground: Color.bar.text
property color background: Color.bar.background
property color urgent: Color.bar.active
property string weatherText: "" property string weatherText: ""
property string weatherClass: "" property string weatherClass: ""
property bool updateAvailable: false property bool updateAvailable: false
@@ -438,18 +441,6 @@ Item {
} }
} }
function loadTheme(raw) {
var lines = String(raw || "").split("\n")
for (var i = 0; i < lines.length; i++) {
var match = lines[i].match(/^\s*([A-Za-z0-9_-]+)\s*=\s*["']?(#[0-9A-Fa-f]{6})/)
if (!match) continue
if (match[1] === "foreground") foreground = match[2]
else if (match[1] === "background") background = match[2]
else if (match[1] === "red") urgent = match[2]
}
}
function updateWeather(raw) { function updateWeather(raw) {
var data = parseModuleJson(raw) var data = parseModuleJson(raw)
weatherText = data.text || "" weatherText = data.text || ""
@@ -723,26 +714,6 @@ Item {
onTriggered: root.tooltipShown = true onTriggered: root.tooltipShown = true
} }
// The host owns shell.json loading and injects `barConfig`. Bar still keeps
// its own theme FileView since theme colors are independent of shell.json.
// `omarchy-theme-set` recreates the entire theme/ directory via rm+mv, which
// invalidates the inotify watch on colors.toml. Use theme.name (overwritten
// in place) to force a fresh reload after each swap.
FileView {
id: themeColorsFile
path: root.home + "/.config/omarchy/current/theme/colors.toml"
watchChanges: true
printErrors: false
onLoaded: root.loadTheme(text())
onFileChanged: reload()
}
FileView {
path: root.home + "/.config/omarchy/current/theme.name"
watchChanges: true
printErrors: false
onFileChanged: themeColorsFile.reload()
}
// Presence of the `bar-off` flag = bar hidden. Watching the parent toggles // Presence of the `bar-off` flag = bar hidden. Watching the parent toggles
// directory because FileView can't observe a file that doesn't exist yet, // directory because FileView can't observe a file that doesn't exist yet,
// and the flag is created/removed by `omarchy-toggle-bar`. // and the flag is created/removed by `omarchy-toggle-bar`.
@@ -1,6 +1,7 @@
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Hyprland import Quickshell.Hyprland
import qs.Commons
PopupWindow { PopupWindow {
id: root id: root
@@ -89,8 +90,8 @@ PopupWindow {
Rectangle { Rectangle {
id: card id: card
anchors.fill: parent anchors.fill: parent
color: root.bar ? root.bar.background : "#101315" color: Color.popups.background
border.color: root.bar ? root.bar.foreground : "#cacccc" border.color: Color.popups.border
border.width: 1 border.width: 1
radius: 0 radius: 0
opacity: root.open ? 1.0 : 0 opacity: root.open ? 1.0 : 0
@@ -4,6 +4,7 @@ import Quickshell.Wayland
import QtQuick import QtQuick
import QtQuick.Effects import QtQuick.Effects
import QtQuick.Shapes import QtQuick.Shapes
import qs.Commons
Item { Item {
id: root id: root
@@ -22,7 +23,6 @@ Item {
property string imageRows: "" property string imageRows: ""
property string selectionFile: Quickshell.env("OMARCHY_IMAGE_SELECTOR_SELECTION_FILE") || Quickshell.env("OMARCHY_BACKGROUND_SELECTION_FILE") property string selectionFile: Quickshell.env("OMARCHY_IMAGE_SELECTOR_SELECTION_FILE") || Quickshell.env("OMARCHY_BACKGROUND_SELECTION_FILE")
property string selectedImage: Quickshell.env("OMARCHY_IMAGE_SELECTOR_SELECTED") property string selectedImage: Quickshell.env("OMARCHY_IMAGE_SELECTOR_SELECTED")
property string colorsFile: Quickshell.env("OMARCHY_IMAGE_SELECTOR_COLORS_FILE") || (Quickshell.env("HOME") + "/.config/omarchy/current/theme/image-picker-colors.json")
property int selectedIndex: 0 property int selectedIndex: 0
property bool imagesLoaded: false property bool imagesLoaded: false
property bool opened: false property bool opened: false
@@ -34,9 +34,11 @@ Item {
property string doneFile: "" property string doneFile: ""
property string filterText: "" property string filterText: ""
property var doneFilesToRelease: [] property var doneFilesToRelease: []
property color accent: "#798186" // Bound to the central [image-picker] section in shell.toml via Color.qml.
property color background: "#101315" property color background: Color.imagePicker.background
property color foreground: "#cacccc" property color foreground: Color.imagePicker.text
property color selectedBorder: Color.imagePicker.selectedBorder
property color unselectedBorder: Color.imagePicker.unselectedBorder
property int expandedWidth: 768 property int expandedWidth: 768
property int expandedHeight: 475 property int expandedHeight: 475
property int sliceWidth: 108 property int sliceWidth: 108
@@ -250,7 +252,7 @@ Item {
carousel.forceActiveFocus() carousel.forceActiveFocus()
} }
function openSelector(nextImageDirs, nextImageRows, nextSelectedImage, nextSelectionFile, nextDoneFile, nextColorsFile, nextColorsRaw, nextShowLabels, nextFilterable) { function openSelector(nextImageDirs, nextImageRows, nextSelectedImage, nextSelectionFile, nextDoneFile, nextShowLabels, nextFilterable) {
if (requestActive && doneFile && doneFile !== nextDoneFile) if (requestActive && doneFile && doneFile !== nextDoneFile)
finishDoneFile(doneFile) finishDoneFile(doneFile)
@@ -265,9 +267,6 @@ Item {
showLabels = nextShowLabels === true || nextShowLabels === "true" showLabels = nextShowLabels === true || nextShowLabels === "true"
filterable = nextFilterable === true || nextFilterable === "true" filterable = nextFilterable === true || nextFilterable === "true"
filterText = "" filterText = ""
colorsFile = nextColorsFile || (Quickshell.env("HOME") + "/.config/omarchy/current/theme/image-picker-colors.json")
if (nextColorsRaw)
loadColors(nextColorsRaw)
imageArray = [] imageArray = []
selectedIndex = 0 selectedIndex = 0
imagesLoaded = false imagesLoaded = false
@@ -320,11 +319,9 @@ Item {
var sel = String(args.selectedImage || selectedImage) var sel = String(args.selectedImage || selectedImage)
var selFile = String(args.selectionFile || "") var selFile = String(args.selectionFile || "")
var doneF = String(args.doneFile || "") var doneF = String(args.doneFile || "")
var colors = String(args.colorsFile || colorsFile)
var colorsRaw = String(args.colorsRaw || "")
var labels = args.showLabels === true || args.showLabels === "true" var labels = args.showLabels === true || args.showLabels === "true"
var filter = args.filterable === true || args.filterable === "true" var filter = args.filterable === true || args.filterable === "true"
openSelector(dirs, rows, sel, selFile, doneF, colors, colorsRaw, labels, filter) openSelector(dirs, rows, sel, selFile, doneF, labels, filter)
} }
function close() { function close() {
@@ -332,9 +329,9 @@ Item {
} }
// IPC surface. All arguments are strings (Quickshell IPC marshalling). // IPC surface. All arguments are strings (Quickshell IPC marshalling).
// imageRows and colorsRaw can contain newlines/tabs, so the CLI caller // imageRows can contain newlines/tabs, so the CLI caller base64-encodes
// base64-encodes them; everything else passes through verbatim. The two // it; everything else passes through verbatim. The two boolean-like
// boolean-like fields use the literal strings "true" or "false". // fields use the literal strings "true" or "false".
IpcHandler { IpcHandler {
target: "image-selector" target: "image-selector"
@@ -343,14 +340,11 @@ Item {
selectedImage: string, selectedImage: string,
selectionFile: string, selectionFile: string,
doneFile: string, doneFile: string,
colorsFile: string,
colorsRawB64: string,
showLabels: string, showLabels: string,
filterable: string): string { filterable: string): string {
var rows = root.decodeBase64(imageRowsB64) var rows = root.decodeBase64(imageRowsB64)
var colorsRaw = root.decodeBase64(colorsRawB64)
root.openSelector(imageDirs, rows, selectedImage, selectionFile, doneFile, root.openSelector(imageDirs, rows, selectedImage, selectionFile, doneFile,
colorsFile, colorsRaw, showLabels, filterable) showLabels, filterable)
return "ok" return "ok"
} }
@@ -363,25 +357,6 @@ Item {
} }
} }
// Tolerate the file being absent (e.g. theme templates not yet re-rendered
// after the rename) without a startup warning.
FileView {
path: root.colorsFile
watchChanges: true
printErrors: false
onLoaded: root.loadColors(text())
onFileChanged: reload()
}
function loadColors(raw) {
try {
var colors = JSON.parse(raw || "{}")
root.accent = colors.primary || root.accent
root.background = colors.background || root.background
root.foreground = colors.backgroundText || root.foreground
} catch (e) {}
}
Process { Process {
id: applyProc id: applyProc
onExited: { onExited: {
@@ -557,7 +532,7 @@ Item {
preferredRendererType: Shape.CurveRenderer preferredRendererType: Shape.CurveRenderer
ShapePath { ShapePath {
fillColor: "transparent" fillColor: "transparent"
strokeColor: item.selected ? root.accent : root.withAlpha(root.foreground, 0.28) strokeColor: item.selected ? root.selectedBorder : root.withAlpha(root.unselectedBorder, 0.28)
strokeWidth: item.selected ? 3 : 1 strokeWidth: item.selected ? 3 : 1
startX: item.topLeft; startY: 0 startX: item.topLeft; startY: 0
PathLine { x: item.topRight; y: 0 } PathLine { x: item.topRight; y: 0 }
@@ -2,6 +2,7 @@ import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Wayland import Quickshell.Wayland
import QtQuick import QtQuick
import qs.Commons
Item { Item {
id: root id: root
@@ -15,22 +16,13 @@ Item {
// Plugin lifecycle hooks. The host calls open(payloadJson) after // Plugin lifecycle hooks. The host calls open(payloadJson) after
// `omarchy-shell-ipc shell summon omarchy.menu ...` and close() when hidden. // `omarchy-shell-ipc shell summon omarchy.menu ...` and close() when hidden.
property string pendingInitialMenu: "root" property string pendingInitialMenu: "root"
property string pendingColorsRaw: ""
function decodeBase64(value) {
var s = String(value || "")
if (!s) return ""
try { return Qt.atob(s) } catch (e) { return s }
}
function open(payloadJson) { function open(payloadJson) {
var payload = ({}) var payload = ({})
try { payload = JSON.parse(payloadJson || "{}") } catch (e) { payload = ({}) } try { payload = JSON.parse(payloadJson || "{}") } catch (e) { payload = ({}) }
root.pendingInitialMenu = payload.initialMenu || payload.menu || "root" root.pendingInitialMenu = payload.initialMenu || payload.menu || "root"
root.pendingColorsRaw = payload.colorsRawBase64 ? root.decodeBase64(payload.colorsRawBase64) : (payload.colorsRaw || "")
if (payload.fontFamily) root.fontFamily = payload.fontFamily if (payload.fontFamily) root.fontFamily = payload.fontFamily
if (root.pendingColorsRaw) root.loadColors(root.pendingColorsRaw)
root.openExistingMenu(root.pendingInitialMenu) root.openExistingMenu(root.pendingInitialMenu)
} }
@@ -40,7 +32,6 @@ Item {
} }
property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace" property string fontFamily: Quickshell.env("OMARCHY_MENU_FONT") || "monospace"
property string colorsFile: Quickshell.env("OMARCHY_MENU_COLORS_FILE") || (Quickshell.env("HOME") + "/.config/omarchy/current/theme/colors.toml")
property string styleFile: Quickshell.env("OMARCHY_MENU_STYLE_FILE") || (Quickshell.env("HOME") + "/.local/state/omarchy/toggles/quickshell-menu.json") property string styleFile: Quickshell.env("OMARCHY_MENU_STYLE_FILE") || (Quickshell.env("HOME") + "/.local/state/omarchy/toggles/quickshell-menu.json")
// JSONC menu definitions. The shell parses both at startup and merges // JSONC menu definitions. The shell parses both at startup and merges
// the user file on top of the defaults, so the keybind → IPC → visible // the user file on top of the defaults, so the keybind → IPC → visible
@@ -61,9 +52,10 @@ Item {
property var navStack: [] property var navStack: []
property var providersLoaded: ({}) property var providersLoaded: ({})
property var providerQueue: [] property var providerQueue: []
property color accent: "#89b4fa" // Bound to the central [menu] section in shell.toml via Color.qml.
property color background: "#101315" property color accent: Color.menu.selected
property color foreground: "#cacccc" property color background: Color.menu.background
property color foreground: Color.menu.text
property color border: foreground property color border: foreground
property int cornerRadius: 0 property int cornerRadius: 0
property int contentMargin: 18 property int contentMargin: 18
@@ -624,18 +616,6 @@ Item {
Qt.callLater(function() { keyCatcher.forceActiveFocus() }) Qt.callLater(function() { keyCatcher.forceActiveFocus() })
} }
function loadColors(raw) {
var lines = String(raw || "").split("\n")
for (var i = 0; i < lines.length; i++) {
var match = lines[i].match(/^\s*([A-Za-z0-9_-]+)\s*=\s*["']?(#[0-9A-Fa-f]{6})/)
if (!match) continue
if (match[1] === "foreground") foreground = match[2]
else if (match[1] === "background") background = match[2]
else if (match[1] === "color4" || match[1] === "accent") accent = match[2]
}
border = foreground
}
function loadStyle(raw) { function loadStyle(raw) {
try { try {
var style = JSON.parse(raw || "{}") var style = JSON.parse(raw || "{}")
@@ -811,13 +791,6 @@ Item {
} }
} }
FileView {
path: root.colorsFile
watchChanges: true
onLoaded: root.loadColors(text())
onFileChanged: { reload(); root.loadColors(text()) }
}
FileView { FileView {
path: root.styleFile path: root.styleFile
watchChanges: true watchChanges: true
@@ -33,17 +33,6 @@ Item {
readonly property string cacheDir: home + "/.cache/omarchy/" readonly property string cacheDir: home + "/.cache/omarchy/"
readonly property string imageCacheDir: cacheDir + "notification-images/" readonly property string imageCacheDir: cacheDir + "notification-images/"
readonly property string styleStatePath: home + "/.local/state/omarchy/toggles/quickshell-menu.json" readonly property string styleStatePath: home + "/.local/state/omarchy/toggles/quickshell-menu.json"
// Optional per-theme override file. Themes that want notification colors
// to diverge from the rest of the palette can ship this file. Schema:
// {
// "borderColor": "#hex",
// "backgroundColor": "#hex",
// "textColor": "#hex",
// "countdownColor": "#hex" // progress bar at bottom of popup
// }
// All keys optional; unset keys fall back to the live Color.* tokens.
readonly property string themeOverridePath: home + "/.config/omarchy/current/theme/notifications.json"
readonly property string themeNamePath: home + "/.config/omarchy/current/theme.name"
// Corner radius is shared with omarchy-shell menu and settings panel — // Corner radius is shared with omarchy-shell menu and settings panel —
// `omarchy style corners <sharp|round>` writes this file once and every // `omarchy style corners <sharp|round>` writes this file once and every
@@ -78,57 +67,6 @@ Item {
onFileChanged: reload() onFileChanged: reload()
} }
// ----------------------------------------------- per-theme color overrides
property string overrideBorder: ""
property string overrideBackground: ""
property string overrideText: ""
property string overrideCountdown: ""
// Match the compact mako-style layout, but keep colors live-bound to the
// current Omarchy theme unless a theme explicitly ships notifications.json.
readonly property color effectiveBorder: overrideBorder.length > 0 ? overrideBorder : Color.accent
readonly property color effectiveBackground: overrideBackground.length > 0 ? overrideBackground : Color.background
readonly property color effectiveText: overrideText.length > 0 ? overrideText : Color.foreground
readonly property color effectiveCountdown: overrideCountdown.length > 0 ? overrideCountdown : Color.accent
function loadThemeOverride(raw) {
try {
var parsed = JSON.parse(raw || "{}")
overrideBorder = typeof parsed.borderColor === "string" ? parsed.borderColor : ""
overrideBackground = typeof parsed.backgroundColor === "string" ? parsed.backgroundColor : ""
overrideText = typeof parsed.textColor === "string" ? parsed.textColor : ""
overrideCountdown = typeof parsed.countdownColor === "string" ? parsed.countdownColor : ""
} catch (e) {
overrideBorder = ""
overrideBackground = ""
overrideText = ""
overrideCountdown = ""
}
}
FileView {
id: themeOverrideFile
path: service.themeOverridePath
watchChanges: true
printErrors: false
onLoaded: service.loadThemeOverride(text())
onLoadFailed: service.loadThemeOverride("")
onFileChanged: reload()
}
// Theme switching recreates ~/.config/omarchy/current/theme, which can leave
// the notifications.json watcher attached to the old symlink target. Watch
// theme.name (overwritten in place) as the stable tripwire and force a fresh
// override reload; if the new theme has no override, onLoadFailed clears the
// old colors instead of leaving stale theme-specific notification styling.
FileView {
path: service.themeNamePath
watchChanges: true
printErrors: false
onFileChanged: themeOverrideFile.reload()
}
// Fired by IPC (`omarchy-shell-ipc notifications showHistory`) so the // Fired by IPC (`omarchy-shell-ipc notifications showHistory`) so the
// bar widget can drop its PopupCard from the same anchor a click would. // bar widget can drop its PopupCard from the same anchor a click would.
signal historyOpenRequested() signal historyOpenRequested()
@@ -948,10 +886,6 @@ Item {
urgency: cardSlot.urgency urgency: cardSlot.urgency
timestamp: cardSlot.timestamp timestamp: cardSlot.timestamp
cornerRadius: service.cornerRadius cornerRadius: service.cornerRadius
borderColorOverride: service.effectiveBorder
backgroundColorOverride: service.effectiveBackground
textColorOverride: service.effectiveText
countdownColorOverride: service.effectiveCountdown
fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : "" fontFamily: service.shell && service.shell.bar ? service.shell.bar.fontFamily : ""
glyph: cardSlot.glyph glyph: cardSlot.glyph
progress: cardSlot.progress progress: cardSlot.progress
@@ -27,13 +27,6 @@ Rectangle {
property real progress: 1.0 property real progress: 1.0
property bool showProgress: false property bool showProgress: false
// Container can override the theme defaults per-card. Defaults bind to
// the live Color.* tokens, so when the container leaves them alone the
// card still tracks the theme.
property color borderColorOverride: Color.border
property color backgroundColorOverride: Color.background
property color textColorOverride: Color.foreground
property color countdownColorOverride: Color.accent
// System font from shell.json bar.fontFamily, injected by the container. // System font from shell.json bar.fontFamily, injected by the container.
property string fontFamily: "" property string fontFamily: ""
@@ -77,10 +70,10 @@ Rectangle {
readonly property bool hasGlyph: glyph.length > 0 readonly property bool hasGlyph: glyph.length > 0
readonly property bool hasSmallIcon: !mediaMode && (smallIconSource.length > 0 || hasGlyph) readonly property bool hasSmallIcon: !mediaMode && (smallIconSource.length > 0 || hasGlyph)
readonly property color dimColor: Qt.darker(textColorOverride, 1.4) readonly property color dimColor: Qt.darker(Color.notifications.text, 1.4)
readonly property color bodyColor: Qt.darker(textColorOverride, 1.15) readonly property color bodyColor: Qt.darker(Color.notifications.text, 1.15)
readonly property color hoverColor: Qt.rgba(textColorOverride.r, textColorOverride.g, textColorOverride.b, 0.14) readonly property color hoverColor: Qt.rgba(Color.notifications.text.r, Color.notifications.text.g, Color.notifications.text.b, 0.14)
readonly property color accentColor: urgency === 2 ? Color.urgent : (urgency === 0 ? dimColor : countdownColorOverride) readonly property color accentColor: urgency === 2 ? Color.urgent : (urgency === 0 ? dimColor : Color.notifications.countdown)
function sanitizeBody(s) { function sanitizeBody(s) {
return String(s).replace(/<img[^>]*>/gi, "") return String(s).replace(/<img[^>]*>/gi, "")
@@ -92,8 +85,8 @@ Rectangle {
// for symmetry except when the progress bar replaces it. // for symmetry except when the progress bar replaces it.
implicitHeight: mainColumn.implicitHeight + border.width * 2 implicitHeight: mainColumn.implicitHeight + border.width * 2
radius: cornerRadius radius: cornerRadius
color: backgroundColorOverride color: Color.notifications.background
border.color: urgency === 2 ? Color.urgent : borderColorOverride border.color: urgency === 2 ? Color.urgent : Color.notifications.border
border.width: 2 border.width: 2
clip: true clip: true
@@ -145,7 +138,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: root.border.width height: root.border.width
color: root.urgency === 2 ? Color.urgent : root.borderColorOverride color: root.urgency === 2 ? Color.urgent : Color.notifications.border
} }
MouseArea { MouseArea {
@@ -194,7 +187,7 @@ Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
visible: root.hasGlyph && smallIconImage.status !== Image.Ready visible: root.hasGlyph && smallIconImage.status !== Image.Ready
text: root.glyph text: root.glyph
color: root.textColorOverride color: Color.notifications.text
font.family: root.fontFamily font.family: root.fontFamily
font.pixelSize: 18 font.pixelSize: 18
} }
@@ -210,7 +203,7 @@ Rectangle {
visible: root.summary.length > 0 visible: root.summary.length > 0
text: root.summary text: root.summary
font.family: root.fontFamily font.family: root.fontFamily
color: root.textColorOverride color: Color.notifications.text
font.pixelSize: 13 font.pixelSize: 13
font.bold: true font.bold: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
@@ -243,7 +236,7 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: 3 height: 3
color: root.borderColorOverride color: Color.notifications.border
visible: false visible: false
Rectangle { Rectangle {
@@ -3,6 +3,7 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Commons
import "../../ui/settings" as SettingsUi import "../../ui/settings" as SettingsUi
import "./components" as Cmp import "./components" as Cmp
@@ -59,10 +60,12 @@ Item {
readonly property string styleStatePath: home + "/.local/state/omarchy/toggles/quickshell-menu.json" readonly property string styleStatePath: home + "/.local/state/omarchy/toggles/quickshell-menu.json"
// ---------------- theme -------------------------------------------------- // ---------------- theme --------------------------------------------------
property color foreground: "#cacccc" // Settings panel deliberately isn't a themable surface in shell.toml —
property color background: "#101315" // it tracks the foundational palette so every theme renders consistently.
property color accent: "#cacccc" property color foreground: Color.foreground
property color urgent: "#a55555" property color background: Color.background
property color accent: Color.accent
property color urgent: Color.urgent
property string fontFamily: "monospace" property string fontFamily: "monospace"
// Source-of-truth for the shell-wide corner radius. Mirrors what the menu // Source-of-truth for the shell-wide corner radius. Mirrors what the menu
@@ -353,18 +356,6 @@ Item {
mutateSection(section, function(a) { a[index] = cloneJson(newEntry) }) mutateSection(section, function(a) { a[index] = cloneJson(newEntry) })
} }
function loadTheme(raw) {
var lines = String(raw || "").split("\n")
for (var i = 0; i < lines.length; i++) {
var match = lines[i].match(/^\s*([A-Za-z0-9_-]+)\s*=\s*["']?(#[0-9A-Fa-f]{6})/)
if (!match) continue
if (match[1] === "foreground") foreground = match[2]
else if (match[1] === "background") background = match[2]
else if (match[1] === "color4" || match[1] === "accent") accent = match[2]
else if (match[1] === "red") urgent = match[2]
}
}
function loadStyleState(raw) { function loadStyleState(raw) {
try { try {
var s = JSON.parse(raw || "{}") var s = JSON.parse(raw || "{}")
@@ -559,26 +550,6 @@ Item {
onFileChanged: reload() onFileChanged: reload()
} }
// `omarchy-theme-set` does `rm -rf current/theme && mv next-theme current/theme`.
// The atomic swap invalidates the inotify watch on colors.toml (the file's
// inode is gone), so onFileChanged never fires for theme switches. Use
// theme.name — a stable file overwritten in place — as the tripwire and
// force-reload colors.toml from its new path each time it changes.
FileView {
id: themeColorsFile
path: root.home + "/.config/omarchy/current/theme/colors.toml"
watchChanges: true
printErrors: false
onLoaded: root.loadTheme(text())
onFileChanged: reload()
}
FileView {
path: root.home + "/.config/omarchy/current/theme.name"
watchChanges: true
printErrors: false
onFileChanged: themeColorsFile.reload()
}
FileView { FileView {
path: root.styleStatePath path: root.styleStatePath
watchChanges: true watchChanges: true
@@ -1,5 +0,0 @@
{
"primary": "{{ accent }}",
"background": "{{ background }}",
"backgroundText": "{{ foreground }}"
}
+50
View File
@@ -0,0 +1,50 @@
# Omarchy shell colors. Defaults below derive from colors.toml. Any theme
# can ship its own shell.toml at themes/<name>/shell.toml to override
# individual keys — anything left out falls back to the values here.
[bar]
# The bar strip itself
background = "{{ background }}"
# Clock, weather, workspace numbers, indicator glyphs
text = "{{ foreground }}"
# Module in an "active" state: screen recording, voxtype listening,
# weather alert, update available. Same color is used everywhere a
# module wants to call attention to itself.
active = "{{ color1 }}"
[popups]
# Body fill for every flyout opened from the bar: wifi, bluetooth, audio,
# calendar, weather, control-center, notification-center, media. Body text
# inside the flyouts is not separately themable — it follows [bar].text.
background = "{{ background }}"
# 1px outline around the flyout
border = "{{ foreground }}"
[notifications]
# Toast card body
background = "{{ background }}"
# Title and message text
text = "{{ foreground }}"
# Card outline. Most themes match this to their Hyprland active-window
# border so notifications visually belong to the focused window.
border = "{{ accent }}"
# Bottom countdown bar that drains while the toast is on screen
countdown = "{{ accent }}"
[menu]
# Omarchy menu surface (the launcher-style picker invoked by the menu key)
background = "{{ background }}"
# Unhighlighted menu items
text = "{{ foreground }}"
# Currently hovered / keyboard-selected item
selected = "{{ accent }}"
[image-picker]
# Backdrop scrim behind the picker (the picker draws this at ~70% alpha)
background = "{{ background }}"
# Tile labels (image filename / theme name)
text = "{{ foreground }}"
# 3px stroke around the currently selected tile
selected-border = "{{ accent }}"
# 1px stroke around every other tile (picker applies ~28% alpha)
unselected-border = "{{ foreground }}"
+5
View File
@@ -0,0 +1,5 @@
# last-horizon preserves the historical behavior of matching notification
# borders to the theme's Hyprland active-window border ($activeBorderColor
# in hyprland.conf), rather than the accent.
[notifications]
border = "#8a8588"
+5
View File
@@ -0,0 +1,5 @@
# solitude preserves the historical behavior of matching notification
# borders to the theme's Hyprland active-window border ($activeBorderColor
# in hyprland.conf), rather than the accent.
[notifications]
border = "#798186"