Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -180,6 +180,11 @@ Rules:
6. `barWidget.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 @@ -130,6 +130,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) && String(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
97 changes: 97 additions & 0 deletions shell/Ui/BarCollapsible.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import QtQuick
import qs.Commons

// Collapsible bar container. Hides its content behind a chevron and reveals it
// with a hover-to-expand slide, the same gesture the system tray drawer uses.
// Collapsed, the container is only the chevron; it grows to fit its content as
// it opens, so a collapsed group costs no more bar space than its chevron.
//
// 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
// Chevron glyph. Escaped codepoint on purpose: raw Nerd Font glyphs can be
// mangled by file tooling, so the default stays stable this way.
property string icon: ""
property int animationDuration: 600

// A hover reveals transiently; a chevron click pins the drawer open so it
// survives the pointer leaving. pinnedOpen follows collapsedByDefault until the
// first chevron click breaks the binding and hands control to the user. It must
// stay a live binding: BarGroup sets the group's entry — and thus
// collapsedByDefault — right after load, so freezing on completion would lock in
// the pre-entry default and ignore a configured collapsed: false.
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

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

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

// 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
width: implicitWidth
height: implicitHeight
text: root.icon
textRotation: root.vertical ? 90 : 0
onPressed: function(button) {
if (button === Qt.LeftButton) root.pinnedOpen = !root.pinnedOpen
}
}

// The revealed slice. Clipped so the content is wiped 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.revealExtent)
height: root.vertical ? Math.round(root.revealExtent) : 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. On the
// cross axis it is sized to the content and centered, so content shorter
// than the bar sits centered rather than top/left-aligned.
Loader {
id: contentLoader
sourceComponent: root.contentComponent
x: root.vertical ? Math.round((root.barSize - implicitWidth) / 2) : 0
y: root.vertical ? 0 : Math.round((root.barSize - implicitHeight) / 2)
width: root.vertical ? implicitWidth : root.drawerExtent
height: root.vertical ? root.drawerExtent : implicitHeight
}
}
}
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
BarIconContent 1.0 BarIconContent.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 @@ -904,6 +904,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 @@ -1023,6 +1027,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
if (slot.region === "tray" && !intoTraySection) continue

Expand Down Expand Up @@ -1888,6 +1896,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 @@ -1913,6 +1924,7 @@ Item {
required property var modelData
entry: modelData
region: moduleListRoot.region
draggable: moduleListRoot.draggable
}
}
}
Expand All @@ -1931,12 +1943,22 @@ 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 {
id: traySectionComponent

Expand All @@ -1951,9 +1973,13 @@ Item {

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"
readonly property var registryMetadata: root.barWidgetRegistry.metadataFor(root.canonicalWidgetId(moduleName))
readonly property bool firstParty: registryMetadata && registryMetadata.firstParty === true
readonly property string pluginApiId: registered ? root.canonicalWidgetId(moduleName) : "bar-entry:" + moduleName
Expand All @@ -1970,6 +1996,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 @@ -2039,7 +2066,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 @@ -2049,6 +2076,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 @@ -2121,7 +2168,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
}
}
31 changes: 30 additions & 1 deletion shell/plugins/bar/BarModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,33 @@ 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
// Always return a fresh local Array so callers get real Array semantics and
// can't mutate the config-derived layout in place. Array.isArray() also
// 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.slice()
if (items && typeof items === "object" && typeof items.length === "number") {
var result = []
for (var i = 0; i < items.length; ++i) result.push(items[i])
return result
}
return []
}

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