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
7 changes: 4 additions & 3 deletions bin/omarchy-bar
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Usage: omarchy bar <command> [args...]
get <id> <key> Print a per-widget option

Placement:
--section <left|center|right> Target section
--section <left|center|tray|right> Target section; tray is the tray's
drawer
--index <n> Target index
--before <id> Insert before a widget
--after <id> Insert after a widget
Expand Down Expand Up @@ -63,7 +64,7 @@ bar_option_exists() {
}

validate_section() {
[[ $1 =~ ^(left|center|right)$ ]] || fail "section must be left, center, or right"
[[ $1 =~ ^(left|center|tray|right)$ ]] || fail "section must be left, center, tray, or right"
}

validate_index() {
Expand Down Expand Up @@ -294,7 +295,7 @@ bar_widget_default_section() {
}
jq -r --arg id "$1" '
map(select(.id == $id))[0].barWidget.defaultSection // "center"
| if IN("left", "center", "right") then . else "center" end
| if IN("left", "center", "tray", "right") then . else "center" end
' <<<"$catalog"
}

Expand Down
2 changes: 1 addition & 1 deletion bin/omarchy-plugin-add
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ select_bar_widget_placement() {
"$PLUGINS_DIR/$id/manifest.json" >/dev/null 2>&1 || return 0

default_section=$(jq -r '.barWidget.defaultSection // "center"' "$PLUGINS_DIR/$id/manifest.json")
section=$(printf '%s\n' left center right |
section=$(printf '%s\n' left center tray right |
gum choose --header="Place $id in which bar section?" --selected "$default_section") || return 0
[[ -n $section ]] || return 0
ENABLE_PLACEMENT=(--section "$section")
Expand Down
4 changes: 2 additions & 2 deletions bin/omarchy-plugin-enable
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ while (( $# > 0 )); do
esac
done

[[ -z $section || $section =~ ^(left|center|right)$ ]] ||
fail "section must be left, center, or right"
[[ -z $section || $section =~ ^(left|center|tray|right)$ ]] ||
fail "section must be left, center, tray, or right"
[[ -z $index || $index =~ ^[0-9]+$ ]] ||
fail "index must be a non-negative integer"
[[ -z $before || -z $after ]] || fail "use only one of --before or --after"
Expand Down
4 changes: 2 additions & 2 deletions bin/omarchy-plugin-validate
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ jq -e '
if ((.barWidget? | type) == "object" and (.barWidget | has("defaultSection"))) then
.barWidget.defaultSection as $section
| ($section | type) == "string"
and (["left", "center", "right"] | index($section)) != null
and (["left", "center", "tray", "right"] | index($section)) != null
else
true
end
' "$MANIFEST" >/dev/null 2>&1 \
|| fail "'barWidget.defaultSection' must be left, center, or right"
|| fail "'barWidget.defaultSection' must be left, center, tray, or right"

# Read each entry point as a JSON-encoded string (one per line), then decode it,
# so a value that itself contains a newline stays one literal path instead of
Expand Down
5 changes: 4 additions & 1 deletion docs/omarchy-shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ loaded by default when it is built in, so `shell.json` records only the
deviation: a third-party plugin you added under `plugins[]`, a built-in you
switched off under `disabledPlugins[]`. A full bar has no off state: enabling
one replaces the active bar, and it is therefore never offered under Disable.
Bar widgets may set `barWidget.defaultSection` to `left`, `center`, or `right`;
Bar widgets may set `barWidget.defaultSection` to `left`, `center`, `tray`, or `right`;
widgets that omit it default to `center`.

Plugins run as **unsandboxed code** inside `omarchy-shell`. Adding warns you before cloning, plugins land disabled so you can review the code before `omarchy plugin enable`, and updates show a diff before touching anything. Commands confirm in a terminal even when given arguments; without one they refuse rather than guess. Add `--yes` to skip every prompt (the path for scripts and agents). The scoped interfaces remove direct access to authentication services and avoid handing generic cross-plugin service factories to replacement bars, but visual plugins can still traverse ordinary objects in their shared QML scene. Plugin code also has the same user-level file and process access as the shell.
Expand Down Expand Up @@ -169,6 +169,9 @@ Rules:
to replace the full bar.
2. Every plugin instance is one entry — `bar.layout.<section>` for
bar widgets, `plugins[]` for everything else.
The sections are `left`, `center`, `tray` and `right`. `tray` is
drawn inside the tray's drawer, after the app icons, and shows only while
`omarchy.tray` is on the bar; it cannot hold the tray itself.
3. Settings are inline on the entry. No `config:` sub-object, no
merge layers.
4. Built-in bar widget ids are namespaced (`omarchy.clock`, `omarchy.audio`, …).
Expand Down
3 changes: 3 additions & 0 deletions manual/05-the-top-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ The bar configures itself. You don't have to open a config file to move things.

Grab an empty patch of the bar around the center and drag it toward another screen edge, and the bar moves there — left, right, top, or bottom all work, and every widget adapts (vertical bars fall back to compact icon-only forms). A click-and-hold starts the same drag. Double-left-click that same empty space to cycle the bar background from clear to glassy to opaque. And drag any widget to reorder it or throw it into another section.

A widget you want around but not always in view can go in the tray's drawer: drag it onto the tray, and the drawer opens to take it. It sits there after the app icons, shows up whenever the drawer does, and keeps its drawer open while its panel is up. Drag it back out onto the bar to put it back.

If you'd rather pick from a menu, **Trigger → Appearance → Menu Bar** has the position, and **Bar Background** picks how the bar is drawn: **Opaque Bar**, **Glassy Bar** (see-through, with what's behind it blurred), or **Clear Bar**.

The same things have commands, which is what you want for a [dotfiles](31-dotfiles.md) setup:
Expand All @@ -91,6 +93,7 @@ The same things have commands, which is what you want for a [dotfiles](31-dotfil
omarchy bar position bottom
omarchy bar background glassy # opaque, glassy, none, or cycle
omarchy bar move omarchy.clock --section center --index 0
omarchy bar move omarchy.bluetooth --section tray # into the tray's drawer
omarchy bar set omarchy.clock format "HH:mm"
omarchy bar defaults # back to the shipped layout
```
Expand Down
3 changes: 2 additions & 1 deletion shell/Commons/Util.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ QtObject {
return {
left: normalizeLayoutSection(src.left),
center: normalizeLayoutSection(src.center),
right: normalizeLayoutSection(src.right)
right: normalizeLayoutSection(src.right),
tray: normalizeLayoutSection(src.tray)
}
}
}
2 changes: 2 additions & 0 deletions shell/Ui/PluginBarApi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ QtObject {
property bool transparent: false
property bool foregroundAnimationEnabled: true
property bool centerSectionRevealHeld: false
property bool traySectionDragActive: false
property bool traySectionPopoutOpen: false
property bool _centerHoverRevealSuppressed: false
readonly property bool centerHoverRevealSuppressed: _centerHoverRevealSuppressed
property var activePopout: null
Expand Down
92 changes: 89 additions & 3 deletions shell/plugins/bar/Bar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ Item {
property bool tooltipShown: false
property int tooltipRequest: 0
property var activePopout: null
// A widget is being dragged that could go into the tray section, so the
// tray's drawer opens to show where.
readonly property bool traySectionDragActive: !!barDragSource && !barDragSource.hostsTraySection
// An open panel from a widget in the tray section keeps the tray's drawer
// open, so the panel's widget stays on screen under it.
readonly property bool traySectionPopoutOpen: {
var owner = activePopout
if (!owner) return false
for (var i = 0; i < moduleSlots.length; i++) {
var slot = moduleSlots[i]
if (slot && slot.activeItem === owner) return slot.region === "tray"
}
return false
}
property var barDragSource: null
property var barDragTarget: null
property var barDragTargetGeometry: null
Expand Down Expand Up @@ -147,6 +161,8 @@ Item {
api.foregroundAnimationEnabled = Qt.binding(function() { return root.foregroundAnimationEnabled })
api.centerSectionRevealHeld = Qt.binding(function() { return root.centerSectionRevealHeld })
api._centerHoverRevealSuppressed = Qt.binding(function() { return root.centerHoverRevealSuppressed })
api.traySectionDragActive = Qt.binding(function() { return root.traySectionDragActive })
api.traySectionPopoutOpen = Qt.binding(function() { return root.traySectionPopoutOpen })
root.syncPluginBarApiObjects(api)
}

Expand Down Expand Up @@ -642,7 +658,8 @@ Item {
return {
left: pinTrayToInner(normalized.left, "left"),
center: pinTrayToInner(normalized.center, "center"),
right: pinTrayToInner(normalized.right, "right")
right: pinTrayToInner(normalized.right, "right"),
tray: normalized.tray
}
}

Expand Down Expand Up @@ -1000,11 +1017,27 @@ Item {
return null
}

// The tray cannot go into its own drawer.
var intoTraySection = !sourceSlot || !sourceSlot.hostsTraySection
var candidates = []
for (var i = 0; i < moduleSlots.length; i++) {
var slot = moduleSlots[i]
if (!slot || slot === sourceSlot || !slot.visible || slot.width <= 0 || slot.height <= 0) continue
if (sourceWindow && !root.sameWindow(root.slotWindow(slot), sourceWindow)) continue
if (slot.region === "tray" && !intoTraySection) continue

// An empty tray section offers its drawer as the place to drop.
var dropSpace = slot.sectionDropSpace
if (intoTraySection && dropSpace && dropSpace.visible && dropSpace.width > 0 && dropSpace.height > 0) {
var spacePoint = dropSpace.mapToItem(null, 0, 0)
candidates.push({ slot: dropSpace, x: spacePoint.x, y: spacePoint.y, width: dropSpace.width, height: dropSpace.height })
}
// Over the drawer, the drop goes into it, never beside the tray, whose
// edge can line up with the last widget's in there.
if (intoTraySection && slot.hostsTraySection) {
var trayPoint = slot.mapFromItem(null, scenePoint.x, scenePoint.y)
if (slot.traySectionContains(trayPoint.x, trayPoint.y)) continue
}

var slotPoint = { x: slot.x, y: slot.y }
try {
Expand Down Expand Up @@ -1904,6 +1937,15 @@ Item {
}
}

Component {
id: traySectionComponent

ModuleList {
entries: root.layoutEntries("tray")
region: "tray"
}
}

component ModuleSlot: Item {
id: slot

Expand Down Expand Up @@ -1940,11 +1982,37 @@ Item {
// dot should be along the bar, so it tracks what the module paints
// instead of a fraction of whatever slot it happens to fill.
readonly property real panelIndicatorExtent: {
var mark = panelIndicatorItem
if (mark) return Math.max(Style.space(10), Math.round((root.vertical ? mark.height : mark.width) * 0.55))
var key = root.vertical ? "openPanelIndicatorHeight" : "openPanelIndicatorWidth"
var hint = activeItem && key in activeItem ? activeItem[key] : undefined
if (hint !== undefined && hint !== null && hint > 0) return Math.round(hint)
return Math.max(Style.space(10), Math.round((root.vertical ? slot.height : slot.width) * 0.55))
}
// A module holding several things a panel can open from (the tray's
// icons) names the one whose panel is open, and the mark sits under it
// rather than under the middle of the module.
readonly property Item panelIndicatorItem: activeItem && "openPanelIndicatorItem" in activeItem ? activeItem.openPanelIndicatorItem : null
readonly property real panelIndicatorCenter: {
var mark = panelIndicatorItem
if (!mark) return (root.vertical ? slot.height : slot.width) / 2
// A menu opened while the drawer is still sliding open moves with it;
// mapToItem alone would not re-run as the item moves.
var reveal = "revealProgress" in activeItem ? activeItem.revealProgress : 0
var point = mark.mapToItem(slot, mark.width / 2, mark.height / 2)
return root.vertical ? point.y : point.x
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
}
// The tray, or a clone of it, hosts the tray section in its drawer; one
// inside the drawer does not, so the section never holds itself.
readonly property bool hostsTraySection: region !== "tray" && !!activeItem && "sectionHost" in activeItem
readonly property Item sectionDropSpace: hostsTraySection && activeItem.sectionHost ? activeItem.sectionHost.dropSpace : null

function traySectionContains(x, y) {
var host = hostsTraySection ? activeItem.sectionHost : null
if (!host || !host.visible || host.width <= 0 || host.height <= 0) return false
var point = slot.mapToItem(host, x, y)
return point.x >= 0 && point.y >= 0 && point.x <= host.width && point.y <= host.height
}
implicitWidth: activeItem && activeItem.visible ? (root.vertical ? root.barSize : activeItem.implicitWidth) : 0
implicitHeight: activeItem && activeItem.visible ? activeItem.implicitHeight : 0
width: implicitWidth
Expand Down Expand Up @@ -2023,9 +2091,9 @@ Item {
// Snap toward the start of the slot, matching native glyph rendering.
x: root.vertical
? (root.position === "left" ? parent.width - width - inset : inset)
: Math.floor((parent.width - width) / 2)
: Math.floor(slot.panelIndicatorCenter - width / 2)
y: root.vertical
? Math.floor((parent.height - height) / 2)
? Math.floor(slot.panelIndicatorCenter - height / 2)
: (root.position === "top" ? parent.height - height - inset : inset)
z: 50

Expand All @@ -2034,6 +2102,18 @@ Item {
}
}

// The tray section's widgets, drawn inside the tray's drawer. They are
// ordinary module slots of their own region, so they open panels, drag
// and keep settings the way widgets on the bar do.
// Built through a Component outside ModuleSlot: a module list holds
// module slots, so one declared in here would make the types a cycle.
Loader {
readonly property Item host: slot.hostsTraySection ? slot.activeItem.sectionHost : null
parent: host || slot
active: !!host
sourceComponent: traySectionComponent
}

MouseArea {
id: modulePointer

Expand All @@ -2056,6 +2136,12 @@ Item {
// make neighboring modules overlap after a small aborted drag.

onPressed: function(mouse) {
// A press on a widget in the tray's drawer belongs to that widget's
// own slot, underneath this one, so it drags that widget, not the tray.
if (slot.traySectionContains(mouse.x, mouse.y)) {
mouse.accepted = false
return
}
dragging = false
suppressClick = false
pressedX = mouse.x
Expand Down
2 changes: 1 addition & 1 deletion shell/plugins/bar/BarModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function entriesAfter(entries, name) {
// a duplicated id makes the push ambiguous.
function inlineSettingsDelta(current, next) {
if (!isPlainObject(current) || !isPlainObject(next)) return null
var regions = ["left", "center", "right"]
var regions = ["left", "center", "right", "tray"]
var counts = {}
for (var r = 0; r < regions.length; r++) {
var entries = Array.isArray(next[regions[r]]) ? next[regions[r]] : []
Expand Down
Loading