Make defaults live where defaults always live

This commit is contained in:
David Heinemeier Hansson
2026-05-23 11:28:36 +02:00
parent 4cd6593ba3
commit 5fc4921cfc
10 changed files with 18 additions and 19 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ plugin_enabled() {
config_source() {
require_omarchy_path
local defaults_file="$OMARCHY_PATH/shell/shell-defaults.json"
local defaults_file="$OMARCHY_PATH/config/omarchy/shell.json"
if [[ -s $CONFIG_FILE ]] && jq -e 'type == "object" and .version == 1' "$CONFIG_FILE" >/dev/null 2>&1; then
printf '%s' "$CONFIG_FILE"
+2 -2
View File
@@ -7,7 +7,7 @@
set -e
CONFIG_FILE="$HOME/.config/omarchy/shell.json"
DEFAULTS_FILE="$OMARCHY_PATH/shell/shell-defaults.json"
DEFAULTS_FILE="$OMARCHY_PATH/config/omarchy/shell.json"
position=$1
if [[ ! $position =~ ^(top|bottom|left|right)$ ]]; then
@@ -18,7 +18,7 @@ fi
mkdir -p "$(dirname "$CONFIG_FILE")"
tmp=$(mktemp)
# Seed from shell-defaults.json when the user has no shell.json yet (or it's
# Seed from the default shell.json when the user has no shell.json yet (or it's
# malformed). Writing just `{ bar: { position } }` would leave the bar with
# no layout, since the shell treats any valid user config as authoritative
# and does not deep-merge defaults.
+2 -2
View File
@@ -58,7 +58,7 @@ This directory contains Omarchy's source files managed by git. Any changes will
**Reading `~/.local/share/omarchy/` is SAFE and useful** - do it freely to:
- Understand how omarchy commands work: `omarchy theme set --help` or `cat $(which omarchy-theme-set)`
- See default configs before customizing: `cat ~/.local/share/omarchy/shell/shell-defaults.json`
- See default configs before customizing: `cat ~/.local/share/omarchy/config/omarchy/shell.json`
- Check stock theme files to copy for customization
- Reference default hyprland settings: `cat ~/.local/share/omarchy/default/hypr/*`
@@ -154,7 +154,7 @@ inside a single long-running Quickshell process (`omarchy-shell`).
```
~/.config/omarchy/shell.json # User overrides: bar.position, bar.layout, plugins[]
~/.local/share/omarchy/shell/shell-defaults.json # Canonical defaults
~/.local/share/omarchy/config/omarchy/shell.json # Canonical defaults
```
The shell hot-reloads `shell.json` on save — no restart needed for layout
+1 -1
View File
@@ -106,7 +106,7 @@ Rules:
6. `idle.screensaver` and `idle.lock` are seconds since user idle began.
7. `version: 1` is required.
`shell-defaults.json` describes the fresh-install state. When no
`config/omarchy/shell.json` describes the fresh-install state. When no
user `shell.json` exists, defaults are used verbatim. Once the user
customizes, `shell.json` is canonical — there is no deep-merge.
+2 -3
View File
@@ -19,7 +19,6 @@ The runtime layout:
```
shell/
shell.qml entry point (ShellRoot)
shell-defaults.json canonical out-of-the-box config
services/
PluginRegistry.qml discovers, validates plugins, looks up enabled state in shell.json
BarWidgetRegistry.qml unified registry for bar widgets (1p + 3p)
@@ -168,12 +167,12 @@ customization from the shipped defaults lives in it.
| `~/.config/omarchy/shell.json` | the shell | full layout + per-entry settings + enabled plugin list |
| `~/.config/omarchy/plugins/<id>/` | user | drop-in third-party plugin source files |
The `shell-defaults.json` bundled with the shell describes the
The `config/omarchy/shell.json` default config describes the
fresh-install state. When the user has no `shell.json`, the shell uses
the defaults verbatim. Once the user customizes anything, `shell.json`
becomes the authoritative file — we do **not** deep-merge defaults back
in. Pressing **Reset bar to defaults** in `omarchy launch bar settings`
rewrites the `bar` subtree from the current `shell-defaults.json`.
rewrites the `bar` subtree from the current default shell config.
### shell.json shape
+2 -2
View File
@@ -35,8 +35,8 @@ own `manifest.json`.
The status bar. Mounted at startup, lives forever. Layout lives in the
top-level `bar:` subtree of `~/.config/omarchy/shell.json` (with the shell
providing [`shell-defaults.json`](../shell-defaults.json) when the user has
no file). See [`bar/README.md`](bar/README.md) for the widget catalogue
providing [`config/omarchy/shell.json`](../../config/omarchy/shell.json) when
the user has no file). See [`bar/README.md`](bar/README.md) for the widget catalogue
and customization schema.
## Bar settings
+2 -2
View File
@@ -9,12 +9,12 @@ the shell for its whole session.
- `Bar.qml` is Omarchy-owned bar engine code, loaded by the omarchy-shell host. Users should not edit it directly.
- `widgets/` holds simple first-party bar widgets with sibling manifests.
- Feature plugins such as `../audio/`, `../network/`, and `../power/` provide richer popup bar widgets.
- The bar receives its config from the host shell as a `barConfig` property; the host loads it from `~/.config/omarchy/shell.json` (or `shell-defaults.json` when the user has no file).
- The bar receives its config from the host shell as a `barConfig` property; the host loads it from `~/.config/omarchy/shell.json` (or `config/omarchy/shell.json` when the user has no file).
- `omarchy-style-bar-position` updates only the user shell.json file.
## Customizing
The bar config lives under the `bar:` key of [`~/.config/omarchy/shell.json`](../../README.md#shelljson-shape). Out of the box the shell uses [`shell-defaults.json`](../../shell-defaults.json). Once you customize anything via `omarchy launch bar settings` or by editing shell.json directly, your file is canonical — there is no deep-merge.
The bar config lives under the `bar:` key of [`~/.config/omarchy/shell.json`](../../README.md#shelljson-shape). Out of the box the shell uses [`config/omarchy/shell.json`](../../../config/omarchy/shell.json). Once you customize anything via `omarchy launch bar settings` or by editing shell.json directly, your file is canonical — there is no deep-merge.
Launch the visual editor with `omarchy launch bar settings` / `omarchy plugin bar edit` (or run `omarchy-launch-bar-settings`) to reorder widgets, add/remove them, and tweak per-widget options without editing JSON by hand. For scriptable changes, use `omarchy plugin bar list`, `omarchy plugin bar add`, `omarchy plugin bar move`, `omarchy plugin bar remove`, and `omarchy plugin bar set`. You can also right-click empty space to the left or right of the centered clock module to open it; double-left-click the same empty space to toggle bar transparency.
+2 -2
View File
@@ -35,7 +35,7 @@ Item {
property string omarchyPath: Quickshell.env("OMARCHY_PATH")
readonly property string home: Quickshell.env("HOME")
readonly property string userConfigPath: home + "/.config/omarchy/shell.json"
readonly property string defaultsPath: omarchyPath + "/shell/shell-defaults.json"
readonly property string defaultsPath: omarchyPath + "/config/omarchy/shell.json"
// ---------------- theme --------------------------------------------------
// Bar settings deliberately isn't a themable surface in shell.toml — it
@@ -201,7 +201,7 @@ Item {
var parsed = JSON.parse(diskText)
if (Util.isPlainObject(parsed) && parsed.version === 1) defaults = parsed
} catch (e) {
console.warn("Bad shell-defaults JSON, falling back to builtin:", e)
console.warn("Bad default shell JSON, falling back to builtin:", e)
defaults = builtinShellConfig
}
}
+4 -4
View File
@@ -26,10 +26,10 @@ ShellRoot {
property string omarchyPath: Quickshell.env("OMARCHY_PATH")
readonly property string shellPath: omarchyPath + "/shell"
readonly property string firstPartyPluginsDir: shellPath + "/plugins"
readonly property string defaultsPath: shellPath + "/shell-defaults.json"
readonly property string defaultsPath: omarchyPath + "/config/omarchy/shell.json"
readonly property string userConfigPath: home + "/.config/omarchy/shell.json"
// Bundled fallback so the shell can start even when shell-defaults.json is
// Bundled fallback so the shell can start even when the default shell.json is
// missing or unreadable. The bar config here mirrors the on-disk defaults
// closely enough to render a usable bar; not authoritative.
readonly property var builtinShellConfig: ({
@@ -85,7 +85,7 @@ ShellRoot {
if (Util.isPlainObject(parsed) && parsed.version === 1) defaultsConfig = parsed
else defaultsConfig = builtinShellConfig
} catch (e) {
console.warn("shell-defaults.json parse failed, using builtin:", e)
console.warn("default shell.json parse failed, using builtin:", e)
defaultsConfig = builtinShellConfig
}
applyShellConfig()
@@ -107,7 +107,7 @@ ShellRoot {
printErrors: false
onLoaded: shell.loadDefaults(text())
onLoadFailed: function(error) {
console.warn("shell-defaults load failed: " + error + " path=" + shell.defaultsPath)
console.warn("default shell.json load failed: " + error + " path=" + shell.defaultsPath)
shell.loadDefaults("")
}
onFileChanged: reload()