Improve notification look

This commit is contained in:
David Heinemeier Hansson
2026-05-15 20:58:09 +02:00
parent ce44f7b3f8
commit e8fb83de11
3 changed files with 22 additions and 6 deletions
@@ -119,8 +119,8 @@ QtObject {
var match = String(raw || "").match(/\$activeBorderColor\s*=\s*rgba?\(([0-9A-Fa-f]{6,8})\)/)
if (!match) { border = accent; return }
var hex = match[1]
// rgba() in hyprland is AARRGGBB; strip the AA prefix and use the RGB.
if (hex.length === 8) hex = hex.substring(2)
// Hyprland rgba() is RRGGBBAA; strip the AA suffix and use RGB.
if (hex.length === 8) hex = hex.substring(0, 6)
border = "#" + hex
}
@@ -43,6 +43,7 @@ Item {
// }
// 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 —
// `omarchy style corners <sharp|round>` writes this file once and every
@@ -84,7 +85,9 @@ Item {
property string overrideText: ""
property string overrideCountdown: ""
readonly property color effectiveBorder: overrideBorder.length > 0 ? overrideBorder : Color.border
// 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
@@ -105,6 +108,7 @@ Item {
}
FileView {
id: themeOverrideFile
path: service.themeOverridePath
watchChanges: true
printErrors: false
@@ -113,6 +117,18 @@ Item {
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
// bar widget can drop its PopupCard from the same anchor a click would.
signal historyOpenRequested()
@@ -90,7 +90,7 @@ Rectangle {
// Add 2 * border.width so mainColumn (inset by border.width on top/left/right)
// doesn't push content under the bottom edge. The bottom edge is also inset
// for symmetry except when the progress bar replaces it.
implicitHeight: mainColumn.implicitHeight + border.width * 2 + (showProgress ? 3 : 0)
implicitHeight: mainColumn.implicitHeight + border.width * 2
radius: cornerRadius
color: backgroundColorOverride
border.color: urgency === 2 ? Color.urgent : borderColorOverride
@@ -174,7 +174,7 @@ Rectangle {
// Hide the slot when the icon failed to resolve (themed-icon name
// not in the user's icon theme) AND we don't have a glyph fallback
// — prevents rendering Qt's pink broken-image placeholder.
visible: root.hasSmallIcon && (root.hasGlyph || smallIconImage.status !== Image.Error)
visible: false
Image {
id: smallIconImage
@@ -244,7 +244,7 @@ Rectangle {
anchors.bottom: parent.bottom
height: 3
color: root.borderColorOverride
visible: root.showProgress
visible: false
Rectangle {
anchors.left: parent.left