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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ QML_FILES := ui/Service.qml ui/BarWidget.qml ui/App.qml ui/compose/RecoveryContr
ui/components/BackBar.qml \
ui/components/MouseBack.qml \
ui/components/SettingsPage.qml ui/components/AiSettings.qml \
ui/theme/Paint.qml ui/theme/ThemeCatalog.qml ui/theme/AppTheme.qml \
ui/kit/Button.qml ui/kit/TextField.qml ui/kit/Dropdown.qml \
ui/kit/ToggleSwitch.qml ui/kit/NumberField.qml ui/kit/PanelToolTip.qml \
ui/components/SettingsSidebar.qml \
ui/components/CalendarSettings.qml \
ui/components/CalendarEventComposer.qml \
Expand Down Expand Up @@ -171,6 +174,7 @@ test-js:
node ui/tests/test_html_tables.js
node ui/tests/test_direction.js
node ui/tests/test_appearance.js
node ui/tests/test_themes.js
node ui/tests/test_model.js
node ui/tests/test_icons.js
node ui/tests/test_navigation.js
Expand Down
10 changes: 10 additions & 0 deletions app/qml/imports/qs/Commons/Color.qml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ QtObject {
? 1 : root.shellTheme.popups["border-alpha"])
}

// The shell's Color exposes a tooltip surface too; a shared UI file that
// passes a tooltip colour would otherwise read undefined here.
readonly property QtObject tooltip: QtObject {
readonly property color background: root.withAlpha(
root.shellColor(root.shellTheme.popups.text, root.background), 0.97)
readonly property color text: root.shellColor(root.shellTheme.popups.text, root.foreground)
readonly property color border: root.withAlpha(
root.shellColor(root.shellTheme.popups.border, root.border), 1)
}

function updateWatches(store, paths) {
var i
if (watchedStore && typeof watchedStore.watch === "function") {
Expand Down
46 changes: 45 additions & 1 deletion app/qml/imports/qs/Commons/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ QtObject {
controlPaddingY: spacingToken("control-padding-y", 6),
inputPaddingY: spacingToken("input-padding-y", 7),
controlHeight: spacingToken("control-height", 28),
controlGap: spacingToken("control-gap", 8),
hairline: 1, panelGap: 14, controlGap: spacingToken("control-gap", 8),
popupRowHeight: spacingToken("popup-row-height", 28),
dropdownWidth: spacingToken("dropdown-width", 240),
searchableDropdownWidth: spacingToken("searchable-dropdown-width", 260),
Expand Down Expand Up @@ -125,4 +125,48 @@ QtObject {
function selectedBorderFor(foreground, accent) { return withAlpha(stateColor("selected", foreground, accent, foreground), controlNumber("selected-border-alpha", 1)) }
function focusFillFor(foreground, accent) { return withAlpha(stateColor("focus", foreground, accent, stateColor("hover-cursor", foreground, accent, foreground)), controlNumber("focus-fill-alpha", controlNumber("hover-cursor-fill-alpha", 0.08))) }
function focusBorderFor(foreground, accent) { return withAlpha(stateColor("focus", foreground, accent, stateColor("hover-cursor", foreground, accent, foreground)), controlNumber("focus-border-alpha", controlNumber("hover-cursor-border-alpha", 0.25))) }

// The state vocabulary and alphas the shell's Style exposes, which the window's
// Paint singleton delegates to whenever it is not drawing a theme of its own.
// The shell names normal/hover/focus/pressed/selection state colours and the
// composite control helpers; the standalone host answers them from its own
// shell.toml, which is what makes Follow Omarchy the same code on both hosts.
readonly property real normalFillAlpha: controlNumber("normal-fill-alpha", 0.04)
readonly property real hoverFillAlpha: controlNumber("hover-cursor-fill-alpha", 0.08)
readonly property real selectedFillAlpha: controlNumber("selected-fill-alpha", 0.18)
readonly property real pressedFillAlpha: controlNumber("pressed-fill-alpha", 0.22)
readonly property real focusFillAlpha: controlNumber("focus-fill-alpha", hoverFillAlpha)
readonly property real selectionFillAlpha: controlNumber("selection-fill-alpha", 0.35)
readonly property real normalBorderAlpha: controlNumber("normal-border-alpha", 0.4)
readonly property real hoverBorderAlpha: controlNumber("hover-cursor-border-alpha", 0.25)
readonly property real selectedBorderAlpha: controlNumber("selected-border-alpha", 1)
readonly property real focusBorderAlpha: controlNumber("focus-border-alpha", hoverBorderAlpha)

function normalStateColor(foreground, accent) { return stateColor("normal", foreground, accent, foreground) }
function hoverStateColor(foreground, accent) { return stateColor("hover-cursor", foreground, accent, foreground) }
function focusStateColor(foreground, accent) { return stateColor("focus", foreground, accent, hoverStateColor(foreground, accent)) }
function pressedStateColor(foreground, accent) { return stateColor("pressed", foreground, accent, hoverStateColor(foreground, accent)) }
function selectionStateColor(foreground, accent) { return stateColor("selection", foreground, accent, foreground) }

function controlFill(focused, hot, foreground, accent) {
if (focused) return focusFillFor(foreground, accent)
if (hot) return hoverFillFor(foreground, accent)
return normalFillFor(foreground, accent)
}
function controlBorder(focused, hot, foreground, accent) {
if (focused) return focusBorderFor(foreground, accent)
if (hot) return hoverBorderFor(foreground, accent)
return normalBorderFor(foreground, accent)
}
function controlBorderWidth(focused, hot) {
if (focused) return focusBorderWidth
if (hot) return hoverBorderWidth
return normalBorderWidth
}
function controlHasWidth(state) {
if (state === "selected") return selectedBorderWidth > 0
if (state === "hover" || state === "hover-cursor") return hoverBorderWidth > 0
if (state === "focus") return focusBorderWidth > 0
return normalBorderWidth > 0
}
}
6 changes: 6 additions & 0 deletions app/qml/imports/qs/Ui/PanelToolTip.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import qs.Commons as Commons

QQC.ToolTip {
property string fontFamily: Style.font.family
// The shell's PanelToolTip paints a background, a text colour and a border
// colour of its own; the standalone host uses the platform tooltip's palette.
// They exist here so a caller may pass them either way.
property color panelForeground: Commons.Color.tooltip.text
property color panelBackground: Commons.Color.tooltip.background
property color panelBorder: Commons.Color.tooltip.border
delay: Style.tooltipDelay
font.family: fontFamily
font.pixelSize: Style.font.caption
Expand Down
1 change: 1 addition & 0 deletions app/qml/imports/qs/Ui/ToggleSwitch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Item {
property color foreground: Commons.Color.foreground
property color accent: Commons.Color.accent
signal toggled()
signal hovered(bool isHovered)

onCheckedChanged: {
if (toggle.checked !== checked) toggle.checked = checked
Expand Down
104 changes: 104 additions & 0 deletions app/tests/qml/tst_standalone_composition.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,34 @@ TestCase {
function discoveredCount(id) { return 1 }
}

// The shared dialogs on the standalone host's own controls: its button has
// no key handling of its own, so Return reaches a choice only through the
// dialog asking which button holds the focus.
Component {
id: confirmDeleteComponent
Components.ConfirmDeleteDialog {
textColor: Commons.Color.foreground
dimColor: Commons.Color.foreground
dangerColor: Commons.Color.accent
popupBackgroundColor: Commons.Color.background
popupBorderColor: Commons.Color.foreground
panelFontFamily: Style.font.family
}
}

Component {
id: composeExitComponent
Components.ComposeExitDialog {
textColor: Commons.Color.foreground
dimColor: Commons.Color.foreground
dangerColor: Commons.Color.accent
popupBackgroundColor: Commons.Color.background
popupBorderColor: Commons.Color.foreground
panelFontFamily: Style.font.family
currentDraftKey: "draft-one"
}
}

Component {
id: calendarComponent
Components.CalendarSettings {
Expand Down Expand Up @@ -711,6 +739,82 @@ TestCase {
compare(JSON.parse(host.files[path]), {width:1000, height:680})
}

function test_delete_dialog_answers_return_on_standalone_buttons() {
var dialog = createTemporaryObject(confirmDeleteComponent, testCase)
verify(dialog)
var answers = []
dialog.confirmed.connect(function(request) { answers.push(request) })

dialog.openFor({kind: "event", name: "Synthetic meeting", event: {googleId: "one"}})
tryCompare(dialog, "opened", true)
// The buttons live in the popup, which findChild does not walk into.
function named(item, name) {
if (!item) return null
if (item.objectName === name) return item
var kids = item.children || []
for (var i = 0; i < kids.length; i++) {
var found = named(kids[i], name)
if (found) return found
}
return null
}
var popup = popupOf(dialog)
verify(popup, "the delete question is a Popup")
var confirm = named(popup.contentItem, "delete-confirm")
verify(confirm, "the Delete button")
tryVerify(function() { return confirm.activeFocus }, 2000, "Delete holds the focus")
keyClick(Qt.Key_Return)
compare(answers.length, 1, "Return on the default answers it")
compare(answers[0].event.googleId, "one")
tryCompare(dialog, "opened", false)

dialog.openFor({kind: "event", name: "Synthetic meeting", event: {googleId: "two"}})
tryCompare(dialog, "opened", true)
var cancel = named(popup.contentItem, "delete-cancel")
verify(cancel, "the Cancel button")
tryVerify(function() { return confirm.activeFocus }, 2000)
keyClick(Qt.Key_Tab)
verify(cancel.activeFocus, "Tab reaches Cancel")
keyClick(Qt.Key_Return)
tryCompare(dialog, "opened", false)
compare(answers.length, 1, "Return on Cancel deletes nothing")
}

function test_draft_dialog_answers_return_on_standalone_buttons() {
var dialog = createTemporaryObject(composeExitComponent, testCase)
verify(dialog)
var saved = []
var discarded = []
dialog.saveRequested.connect(function(key) { saved.push(key) })
dialog.discardRequested.connect(function(key) { discarded.push(key) })
var popup = popupOf(dialog)
verify(popup, "the draft question is a Popup")
var row = popup.contentItem.children[2]
var cancel = row.children[0]
var discard = row.children[1]
var save = row.children[2]
verify(cancel.text === "Cancel" && discard.text === "Discard" && save.text === "Save draft")

dialog.open()
tryCompare(dialog, "opened", true)
tryVerify(function() { return save.activeFocus }, 2000, "Save draft holds the focus")
keyClick(Qt.Key_Return)
compare(saved, ["draft-one"], "Return on the default saves the draft")
tryCompare(dialog, "opened", false)

dialog.open()
tryCompare(dialog, "opened", true)
tryVerify(function() { return save.activeFocus }, 2000)
keyClick(Qt.Key_Tab)
verify(cancel.activeFocus, "Tab from Save draft reaches Cancel")
keyClick(Qt.Key_Tab)
verify(discard.activeFocus, "and then Discard")
keyClick(Qt.Key_Return)
compare(discarded, ["draft-one"], "Return on Discard discards")
compare(saved.length, 1)
tryCompare(dialog, "opened", false)
}

function test_shell_persists_settings_and_routes_activation_payload() {
var composition = createTemporaryObject(compositionComponent, testCase)
verify(composition)
Expand Down
2 changes: 2 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ The same distinction applies to large feature systems. Dock's pure-data layout,

The visual exception is explicit. GPUI Component theme tokens, dimensions, cursor styling, animation curves, shadows, radii, and surface appearance do not transfer. Omarchy remains the visual authority.

That authority is reached through one module rather than through the shell's singletons directly. `ui/theme/Paint.qml` is the window's colour authority: with Follow Omarchy selected it delegates to `Commons.Color`, `Style` and `Border` so the window is drawn by exactly the code it was drawn by before, and with a theme selected it resolves the same roles from that theme's `colors.toml`. `ui/theme/Themes.js` holds the rules as pure functions — name validation, theme-directory ordering, TOML parsing, palette fallback — so they are testable without a window, and `ui/theme/ThemeCatalog.qml` lists installed themes with the user's directory taking precedence over the installed one. Geometry, typography, spacing, alpha and border widths are never taken from a picked theme: they stay live from `Style`, so a per-app theme can change colour and nothing else. `ui/kit` wraps the shell controls whose internal state colours come from tokens the shell rendered with the desktop's theme baked in.

## Commit design

Commits should preserve the reasoning that makes an architectural choice safe to change later. The best history in both Omamail and GPUI Component follows a consistent structure.
Expand Down
12 changes: 11 additions & 1 deletion docs/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Omamail is a compact, keyboard-capable desktop mail client. It should feel like
- quiet enough for the message to remain primary;
- explicit about state without depending on color alone;
- predictable under keyboard, pointer, and window resizing;
- native to the active Omarchy theme.
- native to the active Omarchy theme, or to the theme chosen for the window.

The screenshots in `preview.png` express the visual baseline: a narrow mailbox rail, a dense list, a generous reader, monospace typography, restrained rules, and controls that appear where their actions belong.

Expand All @@ -28,6 +28,16 @@ All visual tokens come from the active Omarchy theme:

Semantic colors originate in `App.qml` and travel through required component properties. Muted text mixes foreground toward background. Derived fills use the shared `Style` helpers or alpha from an inherited semantic color.

## A theme for this window alone

The desktop's theme is the default and Follow Omarchy the default choice, but a window may be drawn in any theme installed on the machine. That is a convenience for one purpose: reading mail in a light room, or in a higher-contrast theme than the desktop is set to, without changing the desktop, the bar, or any other window. Omamail is still the shell's client; it is not offering a second desktop.

Only colours are chosen. Font, spacing, corner radius, border widths, alpha and every other measurement stay the live shell's, so a window drawn in another theme still fits the desktop's grid and responds to the shell's scale — and a theme that changes one role cannot change the layout. A theme that states no urgent colour, or writes an older file without selection, is answered with the nearest role rather than with a missing colour.

One authority draws the window. `ui/theme/Paint.qml` resolves every colour the app paints, from the desktop's own singletons when Follow Omarchy is selected and from the picked theme's file otherwise. Nothing in the window reads `Commons.Color`, `Style`'s state helpers, or `Border.controlSpec` directly, because the shell renders those from the desktop's theme and they ignore the colour they are handed — a window that asked them for a light theme's foreground would be given the dark desktop's near-white and paint it on white. The bar widget, its popup and desktop notifications are the desktop's own surfaces and keep the desktop's palette, including the unread dot.

Choosing a theme is not a restart: every binding above the choice reads `Paint`, so a window redraws when it changes. An unreadable, missing or malformed choice falls back to Follow Omarchy rather than failing to open, and the settings file's value is treated as a path segment and validated before it is used as one.

Do not import GPUI Component colors, shadows, radii, typography, sidebar width, or control decoration. A GPUI example may demonstrate an interaction contract; its pixels are not a design token for this application.

## What comes from GPUI and GPUI Component
Expand Down
4 changes: 2 additions & 2 deletions docs/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ Qt behaviours this design is shaped around.

## Constraints

- Every colour comes from the active Omarchy theme. No hard-coded hex outside
a brand asset.
- Every colour comes from the active Omarchy theme, or from the Omarchy theme
picked for this window alone. No hard-coded hex outside a brand asset.
- All parsing, formatting, and decision logic lives in `.pragma library` JS
files so it is testable under node without a compositor.
- No dependency beyond what Omarchy already ships: `socat`, `secret-tool`,
Expand Down
8 changes: 7 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"maxMessages": 50,
"heavyMessageRendering": "Show plain text first",
"contentDirection": "Auto",
"appTheme": "",
"defaultQuery": "in:inbox",
"notifyNewMail": "On",
"oauthPort": 9481,
Expand Down Expand Up @@ -117,7 +118,12 @@
"key": "aiAgent",
"type": "enum",
"label": "AI agent",
"options": ["System default", "OpenCode", "Codex", "Claude"],
"options": [
"System default",
"OpenCode",
"Codex",
"Claude"
],
"defaultValue": "System default",
"description": "Agent for new mail chats and calendar suggestions. System default follows Omarchy; unsupported defaults disable AI. Changing the selection starts fresh chats and keeps previous chats read-only. Requires backend API 6."
},
Expand Down
Loading
Loading