Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
998bff3
Add collapsible bar widget groups
GeekyRiolu Aug 15, 2026
b2d23b9
Migrate the tray drawer onto BarCollapsible
GeekyRiolu Aug 15, 2026
45fdbaa
Give the widget group a distinct chevron from the tray
GeekyRiolu Aug 15, 2026
3dd061b
Apply suggestions from code review
GeekyRiolu Aug 15, 2026
cb9d477
Return a real Array from groupItems() for cross-realm items
GeekyRiolu Aug 15, 2026
b87f5e2
Center the collapsible drawer content on the cross axis
GeekyRiolu Aug 15, 2026
7795006
Loosen the collapsible animation test to tolerate reformatting
GeekyRiolu Aug 15, 2026
2f7f16e
Seed the collapsible pinned state once, don't track collapsedByDefault
GeekyRiolu Aug 15, 2026
81fb5b0
Align group detection in layout normalization with BarModel
GeekyRiolu Aug 15, 2026
05ec0ff
Size the tray drawers explicitly
GeekyRiolu Aug 15, 2026
fc9424d
Return a fresh array from groupItems()
GeekyRiolu Aug 15, 2026
9f662bc
Restore OMARCHY_PATH to its exact prior state in the group acceptance…
GeekyRiolu Aug 15, 2026
fdc41fa
Clarify the expandOnHover wording in the bar README
GeekyRiolu Aug 15, 2026
0ad476e
Keep pinnedOpen a live binding so collapsed:false groups start expanded
GeekyRiolu Aug 15, 2026
e017902
Detect OMARCHY_PATH by presence, not value, in the group acceptance test
GeekyRiolu Aug 15, 2026
2947f6d
Document why the group test uses source-regex structural checks
GeekyRiolu Aug 15, 2026
db2bb31
Merge upstream/quattro into bar-widget-group
GeekyRiolu Sep 15, 2026
b81e980
Assert real collapse behavior in the bar group acceptance test
GeekyRiolu Sep 18, 2026
6fbb908
Merge upstream/quattro into bar-widget-group
GeekyRiolu Sep 29, 2026
cea31d8
Merge upstream/quattro into bar-widget-group
GeekyRiolu Oct 13, 2026
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
5 changes: 5 additions & 0 deletions docs/omarchy-shell.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ Rules:
6. `allowMultiple: true` in the manifest permits multiple instances.
7. `idle.screensaver` and `idle.lock` are seconds since user idle began.
8. `version: 1` is required.
9. A `bar.layout.<section>` entry may be a **group**:
`{ "type": "group", "collapsed": true, "items": [ ... ] }`. It wraps its
`items` behind a collapsible chevron (the tray-drawer gesture) and nests
ordinary entries. Groups are additive — older flat layouts stay valid without
a migration. See [`../shell/plugins/bar/README.md`](../shell/plugins/bar/README.md#widget-groups).

`config/omarchy/shell.json` describes the fresh-install state. When no
user `shell.json` exists, defaults are used verbatim. Once the user
Expand Down
10 changes: 10 additions & 0 deletions shell/Commons/Util.qml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ QtObject {
// input config; consumers can mutate without leaking back to shell.json.
function normalizeLayoutEntry(entry) {
if (typeof entry === "string") return { id: canonicalWidgetId(entry) }
// A group wraps child entries behind a collapsible chevron. It has no widget
// id of its own (one is optional, for addressing), so it must be recognized
// before the id branch below, which would otherwise drop it. Its children
// are normalized recursively so the same rules apply at every depth.
if (isPlainObject(entry) && entry.type === "group") {
var group = cloneJson(entry)
if (group.id) group.id = canonicalWidgetId(group.id)
group.items = normalizeLayoutSection(group.items)
return group
}
if (isPlainObject(entry) && entry.id) {
var copy = cloneJson(entry)
copy.id = canonicalWidgetId(copy.id)
Expand Down
138 changes: 138 additions & 0 deletions shell/Ui/BarCollapsible.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import QtQuick
import qs.Commons

// Collapsible bar container. Hides its content behind a chevron and reveals it
// with a hover-to-expand slide. This is the single source of the collapse/expand
// motion for the bar: the system tray drawer and the widget group both use it,
// so the two never drift.
//
// Two layout modes:
// reserveSpace: false (default, widget groups) — space-saving: collapsed the
// container is just the chevron and it grows to fit its content as it opens.
// reserveSpace: true (system tray) — the full extent is always reserved; the
// chevron migrates and the content slides in and out beneath it, and the
// empty reserved area is masked so it does not steal hover or clicks.
//
// Content is supplied as a Component (not default children) so the chevron and
// clip below are not swallowed by a default-property alias, and so the loaded
// item is available to measure for the drawer extent.
Item {
id: root

// Host bar, injected by the caller. Supplies vertical / barSize / theming for
// the chevron. Left null the component still lays out with Style fallbacks.
property var bar: null
readonly property bool vertical: bar ? bar.vertical : false
readonly property int barSize: bar ? bar.barSize : Style.bar.sizeHorizontal

// The content to reveal. Its implicit size along the bar axis is the extent
// the drawer opens to.
property Component contentComponent: null
readonly property Item body: contentLoader.item

property bool collapsedByDefault: true
property bool expandOnHover: true
// Reserve the full extent while collapsed (tray drawer) instead of shrinking
// to just the chevron (widget group).
property bool reserveSpace: false
// Left-click the chevron to pin the drawer open. The tray drives reveal by
// hover alone and uses the chevron's right button for its manage popup, so it
// turns this off and listens to chevronPressed instead.
property bool pinOnClick: true
// Chevron glyph (the same one the tray drawer uses). Escaped codepoint on
// purpose: raw Nerd Font glyphs can be mangled by file tooling, so the default
// stays stable this way.
property string icon: "\uf053"
property int animationDuration: 600

signal chevronPressed(int button)

// A hover reveals transiently; a chevron click pins the drawer open so it
// survives the pointer leaving. collapsedByDefault seeds the pinned state.
property bool pinnedOpen: !collapsedByDefault
property bool hovered: false
readonly property bool open: pinnedOpen || (expandOnHover && hovered)

readonly property real drawerExtent: body ? (vertical ? body.implicitHeight : body.implicitWidth) : 0
property real revealProgress: open ? 1 : 0
readonly property real revealExtent: drawerExtent * revealProgress

// Extent occupied beyond the chevron: the full drawer when space is reserved,
// otherwise only the slice revealed so far.
readonly property real reservedExtent: reserveSpace ? drawerExtent : revealExtent
// In reserve mode the chevron migrates as the drawer opens and the content
// slides under it; in space-saving mode the chevron is fixed and the content
// is wiped in from it.
readonly property real chevronOffset: reserveSpace ? (drawerExtent - revealExtent) : 0
readonly property real clipExtent: reserveSpace ? drawerExtent : revealExtent
readonly property real contentOffset: reserveSpace ? (drawerExtent - revealExtent) : 0

Behavior on revealProgress {
NumberAnimation { duration: root.animationDuration; easing.type: Easing.OutCubic }
}

implicitWidth: vertical ? barSize : Math.round(chevron.implicitWidth + reservedExtent)
implicitHeight: vertical ? Math.round(chevron.implicitHeight + reservedExtent) : barSize

// Reserved-but-empty space must not react to the pointer, or hovering the gap
// beside a collapsed drawer would expand it and clicks would be swallowed.
// Only the chevron and the revealed content are live. Nothing to mask in
// space-saving mode, where the block shrinks to the chevron.
containmentMask: root.reserveSpace ? reserveMask : null
QtObject {
id: reserveMask
function contains(point: point): bool {
if (root.vertical) {
if (point.x < 0 || point.x > root.width) return false
return point.y >= root.chevronOffset && point.y <= root.height
}
if (point.y < 0 || point.y > root.height) return false
return point.x >= root.chevronOffset && point.x <= root.width
}
}

// Whole-container hover drives the transient reveal. A HoverHandler on the
// root sees the chevron and the revealed content as one region, so sliding
// from the chevron onto the content does not collapse it mid-motion.
HoverHandler {
enabled: root.expandOnHover
onHoveredChanged: root.hovered = hovered
}

BarIconButton {
id: chevron
bar: root.bar
x: root.vertical ? 0 : root.chevronOffset
y: root.vertical ? root.chevronOffset : 0
width: implicitWidth
height: implicitHeight
text: root.icon
textRotation: root.vertical ? 90 : 0
onPressed: function(button) {
root.chevronPressed(button)
if (root.pinOnClick && button === Qt.LeftButton) root.pinnedOpen = !root.pinnedOpen
}
}

// The revealed slice. Clipped so the content is wiped/slid in from the chevron
// as the slice grows, and so a partially-open drawer never paints past its edge.
Item {
id: revealClip
x: root.vertical ? 0 : chevron.implicitWidth
y: root.vertical ? chevron.implicitHeight : 0
width: root.vertical ? root.barSize : Math.round(root.clipExtent)
height: root.vertical ? Math.round(root.clipExtent) : root.barSize
clip: true

// The content is laid out at its full extent regardless of how far the
// drawer has opened, so its widgets never reflow as it animates.
Loader {
id: contentLoader
x: root.vertical ? 0 : Math.round(root.contentOffset)
y: root.vertical ? Math.round(root.contentOffset) : 0
width: root.vertical ? root.barSize : root.drawerExtent
height: root.vertical ? root.drawerExtent : root.barSize
sourceComponent: root.contentComponent
}
}
}
1 change: 1 addition & 0 deletions shell/Ui/qmldir
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module qs.Ui

BarCollapsible 1.0 BarCollapsible.qml
BarIndicator 1.0 BarIndicator.qml
BarIconButton 1.0 BarIconButton.qml
BarWidget 1.0 BarWidget.qml
Expand Down
53 changes: 52 additions & 1 deletion shell/plugins/bar/Bar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ Item {
return BarModel.customModuleType(entry)
}

function groupItems(entry) {
return BarModel.groupItems(entry)
}

function customModuleSource(entry) {
var source = BarModel.customModulePath(entry, home, omarchyConfigDir)
return source ? Util.fileUrl(source) : ""
Expand Down Expand Up @@ -693,6 +697,10 @@ Item {
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
// A group and its children are not drop targets: their ids do not address
// the top-level layout a drop is persisted against. Drops snap to the
// nearest ordinary widget instead.
if (slot.isGroup || !slot.draggable) continue
if (sourceWindow && !root.sameWindow(root.slotWindow(slot), sourceWindow)) continue

var slotPoint = { x: slot.x, y: slot.y }
Expand Down Expand Up @@ -1472,6 +1480,9 @@ Item {

property var entries: []
property string region: ""
// Children of a group opt out of individual dragging: the drawer reorders
// as one block, and drop persistence addresses top-level entries by id.
property bool draggable: true

visible: entries.length > 0
// A hidden list must not build its modules. The center section declares
Expand All @@ -1497,6 +1508,7 @@ Item {
required property var modelData
entry: modelData
region: moduleListRoot.region
draggable: moduleListRoot.draggable
}
}
}
Expand All @@ -1515,20 +1527,34 @@ Item {
required property var modelData
entry: modelData
region: moduleListRoot.region
draggable: moduleListRoot.draggable
}
}
}
}
}

// The child list for a group is a plain ModuleList, handed to BarGroup (a
// file type) as a Component. Passing it at runtime — rather than BarGroup
// naming ModuleList, or ModuleSlot naming an inline group component — is what
// keeps the bar's inline components from forming a resolution cycle.
Component {
id: groupListComponent
ModuleList {}
}

component ModuleSlot: Item {
id: slot

required property var entry
property string region: ""
// Slots inside a group opt out of individual dragging; the group reorders
// as one block. Top-level slots are draggable as before.
property bool draggable: true
readonly property string moduleName: root.entryId(entry)
readonly property var moduleSettings: root.entrySettings(entry)
readonly property string customType: root.customModuleType(entry)
readonly property bool isGroup: customType === "group"
// Re-evaluate when the registry mutates (Component reference changes,
// plugin enabled/disabled, etc.). Reading the `widgets` property creates
// the binding dependency — the wrapped function call alone wouldn't.
Expand All @@ -1542,6 +1568,7 @@ Item {
readonly property bool commandCustom: customType === "command"
readonly property bool registered: registryComponent !== null
readonly property var activeItem: {
if (isGroup) return groupLoader.item
if (registered) return registryLoader.item
if (qmlCustom) return qmlLoader.item
return componentLoader.item
Expand Down Expand Up @@ -1585,7 +1612,7 @@ Item {

Loader {
id: componentLoader
active: !slot.qmlCustom && !slot.registered
active: !slot.qmlCustom && !slot.registered && !slot.isGroup
sourceComponent: slot.commandCustom ? customCommandModuleComponent : emptyModuleComponent
anchors.fill: parent
opacity: slot.dragSource ? 0.22 : 1.0
Expand All @@ -1595,6 +1622,26 @@ Item {
}
}

Loader {
id: groupLoader
active: slot.isGroup
// Loaded from a file (not an inline component) so the group -> slot -> group
// recursion does not make the bar's inline components form a cycle.
source: slot.isGroup ? Qt.resolvedUrl("BarGroup.qml") : ""
anchors.fill: parent
opacity: slot.dragSource ? 0.22 : 1.0
onLoaded: {
if (item) {
item.bar = root
item.entry = slot.entry
item.region = slot.region
item.listComponent = groupListComponent
}
slot.injectProps()
Qt.callLater(slot.injectProps)
}
}

Loader {
id: registryLoader
active: slot.registered
Expand Down Expand Up @@ -1654,7 +1701,11 @@ Item {
property bool suppressClick: false
property real pressedX: 0
property real pressedY: 0
// A group and its children are not individually draggable: the group has
// no id to persist a move against, and its children reorder as one block.
// Clicks still route normally — only drag initiation is gated here.
readonly property bool canReorder: root.shell && typeof root.shell.mutateShellConfig === "function"
&& slot.draggable && !slot.isGroup
readonly property real dragThreshold: Style.space(4)

anchors.fill: parent
Expand Down
53 changes: 53 additions & 0 deletions shell/plugins/bar/BarGroup.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import QtQuick
import qs.Ui
import "BarModel.js" as BarModel

// A collapsible group of bar widgets. Kept in its own file rather than an inline
// component of Bar.qml on purpose: a group contains widget slots, and a widget
// slot may itself be a group, so an inline component would make Bar.qml's
// components form a resolution cycle — which QML forbids ("Inline components
// form a cycle!"). A file type can be referenced recursively, so the recursion
// lives here.
//
// The children are rendered by a ModuleList handed in as `listComponent` (a
// runtime Component created by Bar.qml), so this file never names the bar's
// inline ModuleList / ModuleSlot types and the cycle stays broken.
Item {
id: root

property var bar: null
property var entry: null
property string region: ""
// A bare ModuleList component supplied by the bar; its entries/region are
// filled once it loads.
property Component listComponent: null

readonly property var groupSettings: BarModel.entrySettings(entry)

implicitWidth: collapsible.implicitWidth
implicitHeight: collapsible.implicitHeight

BarCollapsible {
id: collapsible
anchors.fill: parent
bar: root.bar
collapsedByDefault: root.groupSettings.collapsed !== false
expandOnHover: root.groupSettings.expandOnHover !== false
// A distinct default glyph so a group next to the tray drawer does not read
// as a second tray; an entry may override it via "icon".
icon: root.groupSettings.icon !== undefined && root.groupSettings.icon !== null
? String(root.groupSettings.icon) : "\uf141"

contentComponent: Component {
Loader {
sourceComponent: root.listComponent
onLoaded: {
if (!item) return
item.entries = BarModel.groupItems(root.entry)
item.region = root.region
item.draggable = false
}
}
}
Comment thread
GeekyRiolu marked this conversation as resolved.
Resolved
}
}
26 changes: 25 additions & 1 deletion shell/plugins/bar/BarModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ function customModuleType(entry) {
return ""
}

// A group is a structural entry that wraps child widgets behind a collapsible
// chevron. It carries type:"group" and an items[] array; an id is optional and
// only used for addressing. Because customModuleType() reports "group" for it,
// the inline-settings delta already treats any change inside a group as
// structural and rebuilds the section — groups are opaque to the live patch for
// now, which is correct if not yet optimal.
function isGroupEntry(entry) {
return isPlainObject(entry) && String(entry.type || "") === "group"
}

function groupItems(entry) {
if (!isGroupEntry(entry)) return []
var items = entry.items
// Array.isArray() returns false for an array created in another QML JS realm
// (the entry is built in Bar.qml but read from BarGroup.qml), so accept
// array-like objects too rather than dropping the children.
if (Array.isArray(items)) return items
if (items && typeof items === "object" && typeof items.length === "number")
return items
Comment thread
GeekyRiolu marked this conversation as resolved.
Resolved
return []
}

function customModulePath(entry, home, configDir) {
var settings = entrySettings(entry)
var name = entryId(entry)
Expand Down Expand Up @@ -226,6 +248,8 @@ if (typeof module !== "undefined") {
expandPath: expandPath,
customModuleSafeName: customModuleSafeName,
customModuleType: customModuleType,
customModulePath: customModulePath
customModulePath: customModulePath,
isGroupEntry: isGroupEntry,
groupItems: groupItems
}
}
Loading