Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions agents/skills/shell-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ unicode characters. Agent file-editing tools can strip multi-byte codepoints
in some positions — do **not** rewrite widget files wholesale through those
tools. For glyph fixes, make a targeted edit with the surrounding context, or
use a Python script that inserts codepoints via `chr(0xXXXXX)`.

## Palette references

Import `qs.Commons as Commons` and use `Commons.Color` for the palette singleton, including `Connections.target`. Qt 6.12 introduces a `Color` type in `QtQuick` that shadows unqualified palette references. This applies to first-party components and third-party plugin QML alike. Keep the unqualified `qs.Commons` import when the file also uses `Style`, `Util`, or `Border`.
28 changes: 21 additions & 7 deletions docs/omarchy-shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ overrides like `omarchy display text size` survive theme switches.

## Theme tokens

Shell and plugin QML must qualify the palette singleton because Qt 6.12 introduces its own `Color` type. Import `qs.Commons` with an alias and use `Commons.Color` for palette properties and signal connections:

```qml
import QtQuick
import qs.Commons
import qs.Commons as Commons

Rectangle {
color: Commons.Color.background
}
```

The unqualified import can remain for `Style`, `Util`, and `Border`. Existing third-party plugins that use bare `Color` must make the same change; fixing the host shell does not change a plugin's import scope.

See [`theming.md`](theming.md) for the full theme/template workflow,
including generated `*.tpl` files, gradient helpers, and shell border syntax.

Expand All @@ -200,25 +214,25 @@ or override a single section with `shell.<section>.toml`, merged in by
`omarchy-theme-set-templates` (see [`theming.md`](theming.md)).

`colors.toml` uses `foreground` and `background` for the foundational
text/background palette, exposed to QML as `Color.foreground` and
`Color.background`.
text/background palette, exposed to QML as `Commons.Color.foreground` and
`Commons.Color.background`.

The shell exposes these tokens to QML via three singletons in
`qs.Commons`:

- `Color` — palette (`foreground`, `background`, `accent`, `urgent`)
and per-surface roles (`Color.bar.*`, `Color.popups.*`,
`Color.tooltip.*`, `Color.notifications.*`, `Color.menu.*`,
`Color.polkit.*`, `Color.lock.*`, `Color.imagePicker.*`). Clipboard
and emojis share `Color.menu.*`; the `[launcher]` section is consumed
and per-surface roles (`Commons.Color.bar.*`, `Commons.Color.popups.*`,
`Commons.Color.tooltip.*`, `Commons.Color.notifications.*`, `Commons.Color.menu.*`,
`Commons.Color.polkit.*`, `Commons.Color.lock.*`, `Commons.Color.imagePicker.*`). Clipboard
and emojis share `Commons.Color.menu.*`; the `[launcher]` section is consumed
by the launcher outside shell QML.
- `Style` — structural tokens (`cornerRadius`), shared interactive
state tokens/helpers, spacing (`Style.spacing.*` / `Style.space(px)`),
the type scale (`Style.font.*`), and bar dimensions
(`Style.bar.sizeHorizontal` / `Style.bar.sizeVertical`).
- `Border` — border-spec helpers for QML surfaces. Use with
`BorderSurface` from `qs.Ui` when a border should honor shell theme
gradients or per-side widths. `Color.<section>.border` is only the
gradients or per-side widths. `Commons.Color.<section>.border` is only the
flat-color fallback for code that cannot render a real border.

### Interactive states
Expand Down
9 changes: 5 additions & 4 deletions docs/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ The filename decides the target section, so the `[lock]` header is optional.

The running shell reads `shell.toml` into two QML singletons:

- `Color` for palette and surface roles like `Color.menu.border`.
- `Color` for palette and surface roles like `Commons.Color.menu.border`.
- `Style` for controls, spacing, font scale, corner radius, and bar sizing.

### Borders
Expand Down Expand Up @@ -326,11 +326,12 @@ Plugin and shell QML should use `BorderSurface` for theme-aware borders:

```qml
import qs.Commons
import qs.Commons as Commons
import qs.Ui

BorderSurface {
color: Color.popups.background
borderSpec: Border.surfaceSpec("popups", "border", Color.popups.border, 2)
color: Commons.Color.popups.background
borderSpec: Border.surfaceSpec("popups", "border", Commons.Color.popups.border, 2)
padding: Style.spacing.popupPadding

Item {
Expand All @@ -347,7 +348,7 @@ Use `Border.surfaceSpec(section, token, fallbackColor, fallbackWidth, alphaKey)`
for shell theme tokens (the optional `alphaKey` names the alpha token, e.g.
`"border-alpha"`), `Border.controlSpec(state, foreground, accent, urgent)` for
shared controls, and `Border.flat(color, width)` for a deliberate local border
that should not be overridden by the active theme. `Color.<section>.border` is the
that should not be overridden by the active theme. `Commons.Color.<section>.border` is the
flat first-stop color for consumers that cannot render full border specs.

## Hyprland templates
Expand Down
13 changes: 7 additions & 6 deletions shell/Commons/Border.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma Singleton
import QtQuick
import qs.Commons as Commons
import "BorderGeometry.js" as Geometry

// Central border-spec factory for shell surfaces and controls. A spec carries
Expand All @@ -22,7 +23,7 @@ QtObject {
}

function value(section, key) {
var v = Color.shellValues[section + "." + key]
var v = Commons.Color.shellValues[section + "." + key]
return (v === undefined || v === null) ? "" : v
}

Expand All @@ -39,7 +40,7 @@ QtObject {
var seen = {}
while (s.match(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/) && !seen[s]) {
seen[s] = true
var next = Color.shellValues[s]
var next = Commons.Color.shellValues[s]
if (next === undefined || next === null || String(next).length === 0) break
s = String(next).replace(/^\s+|\s+$/g, "")
}
Expand Down Expand Up @@ -68,10 +69,10 @@ QtObject {

var s = String(color || "").replace(/^\s+|\s+$/g, "")
var role = s.toLowerCase()
if (role === "foreground" || role === "text") return cssColor(Color.foreground, a)
if (role === "accent") return cssColor(Color.accent, a)
if (role === "urgent") return cssColor(Color.urgent, a)
if (role === "background") return cssColor(Color.background, a)
if (role === "foreground" || role === "text") return cssColor(Commons.Color.foreground, a)
if (role === "accent") return cssColor(Commons.Color.accent, a)
if (role === "urgent") return cssColor(Commons.Color.urgent, a)
if (role === "background") return cssColor(Commons.Color.background, a)
if (role === "transparent") return "transparent"
return Geometry.canonicalColor(s, a)
}
Expand Down
43 changes: 22 additions & 21 deletions shell/Commons/Style.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pragma Singleton
import QtQuick
import qs.Commons as Commons
import Quickshell
import Quickshell.Hyprland
import Quickshell.Io
Expand Down Expand Up @@ -114,27 +115,27 @@ QtObject {
}

function resolveStateColor(token, foreground, accent, urgent, fallback) {
var fb = fallback || foreground || Color.foreground
var fb = fallback || foreground || Commons.Color.foreground
var s = String(token || "").replace(/^\s+|\s+$/g, "")
var role = s.toLowerCase()
if (role === "foreground" || role === "text") return foreground || Color.foreground
if (role === "accent") return accent || Color.accent
if (role === "urgent") return urgent || Color.urgent
if (role === "background") return Color.background
if (role === "foreground" || role === "text") return foreground || Commons.Color.foreground
if (role === "accent") return accent || Commons.Color.accent
if (role === "urgent") return urgent || Commons.Color.urgent
if (role === "background") return Commons.Color.background
if (role === "transparent") return Qt.rgba(0, 0, 0, 0)
return colorFromHex(s, fb)
}

function normalStateColor(foreground, accent, urgent) {
return resolveStateColor(normalColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(normalColorToken, foreground, accent, urgent, foreground || Commons.Color.foreground)
}

function hoverStateColor(foreground, accent, urgent) {
return resolveStateColor(hoverColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(hoverColorToken, foreground, accent, urgent, foreground || Commons.Color.foreground)
}

function selectedStateColor(foreground, accent, urgent) {
return resolveStateColor(selectedColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(selectedColorToken, foreground, accent, urgent, foreground || Commons.Color.foreground)
}

function pressedStateColor(foreground, accent, urgent) {
Expand All @@ -149,7 +150,7 @@ QtObject {
}

function selectionStateColor(foreground, accent, urgent) {
return resolveStateColor(selectionColorToken, foreground, accent, urgent, foreground || Color.foreground)
return resolveStateColor(selectionColorToken, foreground, accent, urgent, foreground || Commons.Color.foreground)
}

function normalFillFor(foreground, accent, urgent) { return Util.alpha(normalStateColor(foreground, accent, urgent), normalFillAlpha) }
Expand Down Expand Up @@ -187,17 +188,17 @@ QtObject {
}

// Convenience colors resolved against the foundational palette.
readonly property color normalFill: normalFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color hoverFill: hoverFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color selectedFill: selectedFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color pressedFill: pressedFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color focusFillColor: focusFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color normalBorderColor: normalBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color hoverBorderColor: hoverBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color selectedBorderColor: selectedBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color focusBorderColor: focusBorderFor(Color.foreground, Color.accent, Color.urgent)
readonly property color selectedAccentFill: Util.alpha(Color.accent, selectedFillAlpha)
readonly property color selectionFill: selectionFillFor(Color.foreground, Color.accent, Color.urgent)
readonly property color normalFill: normalFillFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color hoverFill: hoverFillFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color selectedFill: selectedFillFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color pressedFill: pressedFillFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color focusFillColor: focusFillFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color normalBorderColor: normalBorderFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color hoverBorderColor: hoverBorderFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color selectedBorderColor: selectedBorderFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color focusBorderColor: focusBorderFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)
readonly property color selectedAccentFill: Util.alpha(Commons.Color.accent, selectedFillAlpha)
readonly property color selectionFill: selectionFillFor(Commons.Color.foreground, Commons.Color.accent, Commons.Color.urgent)

// ---------------------------------------------------------- spacing
//
Expand Down Expand Up @@ -390,7 +391,7 @@ QtObject {
}

// Pull typography, bar dimensions, state tokens, and spacing out of the
// shell.toml dict that Color already parsed. Called by Color.loadShell so
// shell.toml dict that Color already parsed. Called by Commons.Color.loadShell so
// a single parse pass feeds both singletons.
function applyShellValues(values) {
var fontOut = {}
Expand Down
13 changes: 7 additions & 6 deletions shell/Ui/Button.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import QtQuick
import QtQuick.Controls
import qs.Commons
import qs.Commons as Commons

// The button. One component for every clickable thing in the kit.
// States compose independently and are applied in priority order:
Expand Down Expand Up @@ -32,9 +33,9 @@ BorderSurface {
property bool bordered: false

// Colors. Defaults track the theme; per-instance overrides are honored.
property color foreground: Color.foreground
property color foreground: Commons.Color.foreground
property color background: "transparent"
property color accent: Color.accent
property color accent: Commons.Color.accent

// Sizing.
property string fontFamily: Style.font.family
Expand All @@ -54,9 +55,9 @@ BorderSurface {
// Tooltip palette. Auto-rendered if tooltipText is set. Defaults pull
// from [tooltip] in shell.toml; override per-instance only when a button
// intentionally wants a tooltip that diverges from the theme.
property color tooltipBackground: Color.tooltip.background
property color tooltipForeground: Color.tooltip.text
property color tooltipBorder: Color.tooltip.border
property color tooltipBackground: Commons.Color.tooltip.background
property color tooltipForeground: Commons.Color.tooltip.text
property color tooltipBorder: Commons.Color.tooltip.border

signal clicked()
signal rightClicked()
Expand All @@ -77,7 +78,7 @@ BorderSurface {
readonly property bool hot: mouseArea.containsMouse || hasCursor
readonly property bool _showFocusRing: focusable && activeFocus
readonly property color _selectedColor: Style.selectedStateColor(root.foreground, root.accent)
readonly property var _tooltipBorderSpec: Border.localOrSurfaceSpec("tooltip", "border", root.tooltipBorder, Color.tooltip.border, Math.max(1, Style.normalBorderWidth))
readonly property var _tooltipBorderSpec: Border.localOrSurfaceSpec("tooltip", "border", root.tooltipBorder, Commons.Color.tooltip.border, Math.max(1, Style.normalBorderWidth))
readonly property var _focusBorderSpec: Border.controlSpec("focus", root.foreground, root.accent)
readonly property var _hoverBorderSpec: Border.controlSpec("hover-cursor", root.foreground, root.accent)
readonly property var _selectedBorderSpec: Border.controlSpec("selected", root.foreground, root.accent)
Expand Down
7 changes: 4 additions & 3 deletions shell/Ui/ButtonGroup.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick
import qs.Commons
import qs.Commons as Commons

// Mutually-exclusive row of Buttons — the form-style "pick one of N"
// pattern (bar position top/right/bottom/left, theme preset chips, etc.).
Expand All @@ -25,9 +26,9 @@ Row {

property var options: []
property string value: ""
property color foreground: Color.foreground
property color background: Color.background
property color accent: Color.accent
property color foreground: Commons.Color.foreground
property color background: Commons.Color.background
property color accent: Commons.Color.accent
property string fontFamily: Style.font.family
property real fontSize: Style.font.body
property bool focusable: true
Expand Down
17 changes: 9 additions & 8 deletions shell/Ui/ConfirmDialog.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick
import qs.Commons
import qs.Commons as Commons

Item {
id: root
Expand All @@ -9,11 +10,11 @@ Item {
property string cancelText: "Cancel"
property string confirmText: "Confirm"
property int selectedIndex: 1
property color background: Color.background
property color foreground: Color.foreground
property color scrim: Util.alpha(Color.background, 0.7)
property color selectedBackground: Util.alpha(Color.foreground, 0.08)
property color selectedText: Color.accent
property color background: Commons.Color.background
property color foreground: Commons.Color.foreground
property color scrim: Util.alpha(Commons.Color.background, 0.7)
property color selectedBackground: Util.alpha(Commons.Color.foreground, 0.08)
property color selectedText: Commons.Color.accent
property string fontFamily: Style.font.family
property int cornerRadius: Style.cornerRadius

Expand Down Expand Up @@ -98,18 +99,18 @@ Item {
width: Style.space(88)
height: Style.space(34)
color: selected
? (destructive ? Util.alpha(Color.urgent, 0.22) : root.selectedBackground)
? (destructive ? Util.alpha(Commons.Color.urgent, 0.22) : root.selectedBackground)
: "transparent"
borderSpec: Border.flat(destructive
? (selected ? Color.urgent : Util.alpha(Color.urgent, 0.56))
? (selected ? Commons.Color.urgent : Util.alpha(Commons.Color.urgent, 0.56))
: (selected ? root.selectedText : Util.alpha(root.foreground, 0.38)), Style.normalBorderWidth)
radius: 0

Text {
textFormat: Text.PlainText
anchors.centerIn: parent
text: modelData
color: destructive ? (selected ? Color.urgent : root.foreground) : (selected ? root.selectedText : root.foreground)
color: destructive ? (selected ? Commons.Color.urgent : root.foreground) : (selected ? root.selectedText : root.foreground)
font.family: root.fontFamily
font.pixelSize: Style.font.caption
}
Expand Down
5 changes: 3 additions & 2 deletions shell/Ui/CursorSurface.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import QtQuick
import qs.Commons
import qs.Commons as Commons

// Shared visual chrome for keyboard-and-mouse-navigable items inside a panel.
// Contract: items must NOT read `containsMouse` for color/border. Mouse
Expand All @@ -19,8 +20,8 @@ BorderSurface {
property bool outline: false
property bool bordered: false

property color foreground: Color.foreground
property color accent: Color.accent
property color foreground: Commons.Color.foreground
property color accent: Commons.Color.accent
property color fill: Style.hoverFillFor(foreground, accent)
property color currentFill: Style.selectedFillFor(foreground, accent)

Expand Down
15 changes: 8 additions & 7 deletions shell/Ui/Dropdown.qml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import QtQuick
import QtQuick.Controls
import qs.Commons
import qs.Commons as Commons

// Themed single-select dropdown. Trigger row paints with the kit's focus
// chrome; the popup anchors below and uses Color.popups.background +
// Color.popups.border so it reads as a panel surface rather than the
// chrome; the popup anchors below and uses Commons.Color.popups.background +
// Commons.Color.popups.border so it reads as a panel surface rather than the
// platform-native ComboBox look.
//
// `options` accepts either a plain string[] or an array of
Expand All @@ -22,11 +23,11 @@ Item {
property string value: ""
property var options: []

property color foreground: Color.popups.text
property color background: Color.popups.background
property color popupBorder: Color.popups.border
property color accent: Color.accent
readonly property var popupBorderSpec: Border.localOrSurfaceSpec("popups", "border", popupBorder, Color.popups.border, Style.normalBorderWidth)
property color foreground: Commons.Color.popups.text
property color background: Commons.Color.popups.background
property color popupBorder: Commons.Color.popups.border
property color accent: Commons.Color.accent
readonly property var popupBorderSpec: Border.localOrSurfaceSpec("popups", "border", popupBorder, Commons.Color.popups.border, Style.normalBorderWidth)
property string fontFamily: Style.font.family
property int rowHeight: Style.spacing.controlHeight
property int popupRowHeight: Style.spacing.popupRowHeight
Expand Down
Loading