Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
24 changes: 22 additions & 2 deletions bin/omarchy-bar-text-color
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ text_color=${3:-}
background_color=${4:-}
background_path=""
screen_size=""
blend_color=""
blend_alpha=""

shift 4 2>/dev/null || true
while (($# > 0)); do
Expand All @@ -23,6 +25,11 @@ while (($# > 0)); do
screen_size=${2:-}
shift 2
;;
--blend)
blend_color=${2:-}
blend_alpha=${3:-}
shift 3 2>/dev/null || shift $#
;;
*)
shift
;;
Expand All @@ -40,6 +47,10 @@ fallback() {

valid_hex "$text_color" || fallback
valid_hex "$background_color" || fallback
if [[ -n $blend_color ]]; then
valid_hex "$blend_color" || fallback
[[ $blend_alpha =~ ^(0(\.[0-9]+)?|1(\.0+)?)$ ]] || fallback
fi
[[ $position =~ ^(top|bottom|left|right)$ ]] || fallback
[[ $bar_size =~ ^[0-9]+$ ]] || fallback
omarchy-cmd-present magick || fallback
Expand Down Expand Up @@ -151,7 +162,8 @@ samples=$(MAGICK_MEMORY_LIMIT=512MiB \
-alpha off -colorspace sRGB -sample "$sample_geometry" -depth 8 -compress none ppm:- 2>/dev/null || true)
[[ -n $samples ]] || fallback

result=$(awk -v fg="$text_color" -v bg="$background_color" '
# With --blend, the text sits on a pill: `color` at `alpha` over each sample.
result=$(awk -v fg="$text_color" -v bg="$background_color" -v pill="$blend_color" -v alpha="${blend_alpha:-0}" '
function channel(hex, start) {
return strtonum("0x" substr(hex, start, 2)) / 255
}
Expand Down Expand Up @@ -196,7 +208,15 @@ result=$(awk -v fg="$text_color" -v bg="$background_color" '

for (i = 1; i <= n; i++) {
idx = 4 + (i - 1) * 3
l = rgb_luminance(tokens[idx + 1] / maxval, tokens[idx + 2] / maxval, tokens[idx + 3] / maxval)
r = tokens[idx + 1] / maxval
g = tokens[idx + 2] / maxval
b = tokens[idx + 3] / maxval
if (pill != "") {
r = channel(pill, 2) * alpha + r * (1 - alpha)
g = channel(pill, 4) * alpha + g * (1 - alpha)
b = channel(pill, 6) * alpha + b * (1 - alpha)
}
l = rgb_luminance(r, g, b)
fg_cr[i] = ratio(fg_lum, l)
bg_cr[i] = ratio(bg_lum, l)
fg_sum += fg_cr[i]
Expand Down
22 changes: 22 additions & 0 deletions default/agents/skills/omarchy/hyprland.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,25 @@ Before writing ANY window rules, you MUST fetch the current documentation from t
DO NOT rely on cached or memorized window rule syntax. The format has changed multiple times and using outdated syntax will cause errors or unexpected behavior.

Window rules go in `~/.config/hypr/hyprland.lua` or a required Lua module. Prefer Omarchy's `o.window(match, rules)` helper — see examples in `$OMARCHY_PATH/default/hypr/windows.lua`.

## Layer Rules

Shell surfaces are layers, not windows: `omarchy-bar`, `omarchy-menu`,
`omarchy-notifications`, `omarchy-osd` and the other shell surfaces
(`hyprctl layers` lists them). Blur, animations and similar effects on them are layer rules; the same
syntax caution applies, see https://wiki.hypr.land/configuring/core/rules/layer-rules/.

Blur behind pills on a clear bar, as written for Hyprland 0.56:

```lua
hl.layer_rule({ match = { namespace = "^omarchy-bar$" }, blur = true, ignore_alpha = 0.3 })
```

`ignore_alpha` matters when the bar background is clear (`omarchy bar
background none`): the bar layer spans the whole strip, so without it the
blur covers the empty strip, not only the pills. Hyprland blurs only where
the pill is more opaque than `ignore_alpha`, so the blur shows with a
`[bar] pill-alpha` between 0.3 and 1, set in `~/.config/omarchy/shell.toml`.

Frosted pills need no rule: with pills on, `omarchy bar background glassy`
draws no strip, and the blur Omarchy turns on falls behind the pills alone.
23 changes: 23 additions & 0 deletions default/agents/skills/omarchy/shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,29 @@ are centered as one group; `centerBegin` and `centerEnd` hang off its two
edges. Put a widget beside the clock in `centerBegin` or `centerEnd`, not in
`center`, or the clock moves off center.

## Bar Pills

`"pills"` in the `bar` block of `~/.config/omarchy/shell.json` gives widgets
their own background, so the bar background can be dropped
(`omarchy bar background none`) and the widgets still sit on something. It is
opt-in: unset or `"off"`, there are no pills. It applies on save.

- `"section"` joins neighboring widgets into one pill; a spacer ends it, even
`{"id": "omarchy.spacer", "size": 0}`, and so does a change of
`"group": "<name>"` between neighbors. `"widget"` gives every widget its
own pill. `"pill": false` on a layout entry keeps that widget off pills.
- The bar background sets the pill look: `omarchy bar background opaque`
raises the pills on the bar, `glassy` makes them frosted glass with no
strip, and `none` gives solid pills on the wallpaper.
- Theme keys in the `[bar]` section of `~/.config/omarchy/shell.toml` (or a
theme's `shell.toml`): `pills` (a default mode; `shell.json` wins), `pill`,
`pill-alpha`, `pill-text`, `pill-border`, `pill-border-alpha`,
`pill-radius`, `pill-inset`, `pill-padding`, `pill-gap`. Unset, pills use
the bar colors and Hyprland's rounding. The theme template lists them with
examples: `$OMARCHY_PATH/default/themed/shell.toml.tpl`.
- For frosted pills use `glassy`. Blur behind translucent pills on a clear
bar is a Hyprland layer rule, not a bar setting; see `hyprland.md`.

## Dock

The dock shows on every workspace. As it comes (`first-app`), it is out while the workspace is empty and hidden until the pointer reaches its edge once the workspace has a window; `always` keeps it out and `hidden` keeps it hidden. `off` turns it off. Its pinned apps are desktop ids (`dock.pinned` in `shell.json`):
Expand Down
14 changes: 14 additions & 0 deletions default/themed/shell.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ active = "{{ red }}"
scale-with-font = true
size-horizontal = 26
size-vertical = 28
# Pills: a background per widget or run of widgets, so the bar background can
# be switched off. Off unless a theme or shell.json (bar.pills) turns them on.
# On a glassy bar the pills are frosted glass, pill-alpha capped at 0.35.
# Unset keys fall back to the bar's own colors and Hyprland's rounding.
# pills = "section" # off | section | widget
# pill = "{{ background }}"
# pill-alpha = 0.85
# pill-text = "{{ foreground }}"
# pill-border = "{{ accent }}"
# pill-border-alpha = 0.25
# pill-radius = 8
# pill-inset = 2 # gap to the bar's edges and ends
# pill-padding = 4 # space inside a pill at its ends
# pill-gap = 6 # space between pills

[hyprland]
# Shared Hyprland-derived border tokens. Surface sections reference these so
Expand Down
35 changes: 28 additions & 7 deletions docs/omarchy-shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,33 @@ A panel matches a screen whose connector name starts with `connector` and whose

Until Hyprland reports a screen's mode, a top bar there waits to appear if a description names the screen's connector, unless the logical size times Qt's whole-number scale already matches a panel. It then appears at its floor rather than growing once windows are laid out, and never guesses a floor for a panel nothing describes. After two seconds without a mode it appears without a floor. Notifications clear the bar as thick as it is on their screen. A plugin's `shell.bar` gives the same through `barSizeFor(screenName)` and the `barSizes` map (screen name to thickness); its `barSize` stays the configured size, which the widgets are drawn at.

### Bar pills

Pills give bar widgets their own background, so the bar background can be dropped (`"background": "none"`) and the widgets still sit on something. They are off unless you turn them on, so a stock bar is unchanged.

Turn them on with `"pills": "section"` under `bar` in `shell.json`, or let a theme set a default with `[bar] pills`. `shell.json` wins.

| Mode | Effect |
|---|---|
| `off` | no pills |
| `section` | one pill per run of neighboring widgets. A spacer ends the run, even at `"size": 0`, and so does a change of `"group"` value between neighbors |
| `widget` | one pill per widget |

These `[bar]` keys shape the pills. All are optional.

| Key | Default | Effect |
|---|---|---|
| `pill` | see below | fill color |
| `pill-alpha` | `background-alpha` | fill opacity, 0 to 1, used with `pill` or on a clear bar; a glassy bar caps it at 0.35 |
| `pill-text` | picked | widget text while pills are on, `"pill": false` widgets included. Unset, the shell picks `text` or the theme background, whichever contrasts more with the pill, composited over the wallpaper when the pill is translucent on a clear bar. On a glassy bar it is `text`, as on the glassy bar itself |
| `pill-border`, `pill-border-alpha` | none | a 1 px outline; shown when its alpha is above 0, also on a transparent fill |
| `pill-radius` | Hyprland `decoration:rounding` | corner radius; 0 is square; capped at half the pill's thickness |
| `pill-inset` | 2 | gap between a pill and the bar's edges and ends |
| `pill-padding` | 4 | space inside a pill at its ends |
| `pill-gap` | 6 | space between neighboring pills |

Unset, `pill` depends on the bar background. On a clear bar (`"background": "none"`) the pill is the bar `background` at `background-alpha`, so the bar color stays behind the widgets. On an opaque bar that color would not show, so the pill is `text` at 10% over the bar, a raised tone that works for dark and light themes. On a glassy bar the strip is not drawn and the pills take its glass: the pill color at no more than 35% opacity, and Omarchy's blur behind the bar falls on the pills alone. A theme that sets `pill` gets that color in every state. The sizes scale with the font like the bar sizes above; a `pill-radius`, `pill-inset`, `pill-padding` or `pill-gap` of 0 stays 0.

## Custom bar modules

If a full plugin is overkill, declare a one-off module inline in
Expand All @@ -446,13 +473,7 @@ For a custom QML widget:
{ "id": "gpu", "type": "qml" }
```

Then `~/.config/omarchy/bar/modules/gpu.qml` (or set `source` to point
elsewhere). The module is an `Item` and receives `bar`, `moduleName`,
`settings` properties. `bar` exposes `foreground` / `background` /
`urgent` / `fontFamily` / `position` / `vertical` / `barSize`, plus
`run(cmd)`, `showTooltip(t, s)` / `hideTooltip(t)`,
`requestPopout(o)` / `releasePopout(o)`. To shell-quote arguments for
`run`, use `Util.shellQuote(v)` from `qs.Commons`.
Then `~/.config/omarchy/bar/modules/gpu.qml` (or set `source` to point elsewhere). The module is an `Item` and receives `bar`, `moduleName`, `settings` properties. `bar` exposes `foreground` / `background` / `barForeground` (the text color to draw on the bar; it follows the clear-bar sampler and pills) / `pillsOn` / `urgent` / `fontFamily` / `position` / `vertical` / `barSize`, plus `run(cmd)`, `showTooltip(t, s)` / `hideTooltip(t)`, `requestPopout(o)` / `releasePopout(o)`. To shell-quote arguments for `run`, use `Util.shellQuote(v)` from `qs.Commons`.

A module that declares `property string fixedEdge` also receives the edge of itself that stays put when it grows, set by how its section is anchored. Widgets that extend `BarWidget` from `qs.Ui` declare it already.

Expand Down
6 changes: 6 additions & 0 deletions shell/Commons/Color.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ QtObject {
property color background: root.composed("bar.background", "bar.background-alpha", root.background, 1.0)
property color text: root.pick("bar.text", root.foreground)
property color active: root.pick("bar.active", root.urgent)
// Pills default to the bar background itself, alpha included, so every
// theme gets them with no new keys. The border is off until a theme gives
// it an alpha.
property color pill: root.composed("bar.pill", "bar.pill-alpha", root.pick("bar.background", root.background), root.pickAlpha("bar.background-alpha", 1.0))
property color pillText: root.pick("bar.pill-text", root.bar.text)
property color pillBorder: root.composed("bar.pill-border", "bar.pill-border-alpha", root.foreground, 0.0)
}
readonly property QtObject popups: QtObject {
property color background: root.composed("popups.background", "popups.background-alpha", root.background, 1.0)
Expand Down
22 changes: 21 additions & 1 deletion shell/Commons/Style.qml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,16 @@ QtObject {
return Math.max(1, Math.round(base))
}

// Bar tokens that keep a deliberate 0, such as a pill gap. barToken() floors
// at 1 and reads 0 as "unset", so these need a reader of their own.
function barInsetToken(key, fallback) {
var v = barOverrides[key]
var n = Number(v)
var base = (isFinite(n) && n >= 0) ? n : fallback
if (barScaleWithFont) base *= fontScale
return Math.max(0, Math.round(base))
}

function boolToken(value, fallback) {
if (value === undefined || value === null) return fallback
var s = String(value).replace(/^\s+|\s+$/g, "").toLowerCase()
Expand Down Expand Up @@ -367,6 +377,15 @@ QtObject {
readonly property int iconFont: root.barToken("icon-font", 13)
readonly property int iconSize: Math.min(iconCanvas, root.barToken("icon-size", 12))
readonly property int statusSlot: root.barToken("status-slot", 21)
// Pills (bar.pills in shell.json). pill-inset is the gap between a pill
// and the bar's edges and ends; pill-padding the space inside a pill at
// its ends. Radius, inset, padding and gap keep a deliberate 0; unset,
// the radius follows Hyprland's rounding, capped at half the pill's
// thickness.
readonly property int pillRadius: root.barOverrides["pill-radius"] !== undefined ? root.barInsetToken("pill-radius", 0) : root.cornerRadius
readonly property int pillInset: root.barOverrides["pill-inset"] !== undefined ? root.barInsetToken("pill-inset", 0) : root.space(2)
readonly property int pillPadding: root.barInsetToken("pill-padding", 4)
readonly property int pillGap: root.barInsetToken("pill-gap", 6)
}

// Off with Hyprland's own animations, as `omarchy toggle animations` turns
Expand Down Expand Up @@ -470,7 +489,8 @@ QtObject {
nextBarScaleWithFont = boolToken(raw, nextBarScaleWithFont)
} else if (key === "size-horizontal" || key === "size-vertical" || key === "notch-height"
|| key === "icon-slot" || key === "icon-canvas" || key === "icon-font"
|| key === "icon-size" || key === "status-slot") {
|| key === "icon-size" || key === "status-slot"
|| key === "pill-radius" || key === "pill-inset" || key === "pill-padding" || key === "pill-gap") {
var b = parseInt(raw, 10)
if (isFinite(b)) barOut[key] = b
Comment thread
cristian-fleischer marked this conversation as resolved.
Resolved
}
Expand Down
1 change: 1 addition & 0 deletions shell/Ui/PluginBarApi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ QtObject {
property bool barHidden: false
property bool sessionLocked: false
property int barSize: 0
property bool pillsOn: false
property bool transparent: false
property bool foregroundAnimationEnabled: true
property bool traySectionDragActive: false
Expand Down
Loading