Extract menu opener widget

This commit is contained in:
David Heinemeier Hansson
2026-05-20 17:53:05 +02:00
parent 1ff343428c
commit 647bb88ab2
4 changed files with 27 additions and 14 deletions
+1 -12
View File
@@ -258,7 +258,6 @@ Item {
function builtinModuleComponent(name) {
switch (String(name)) {
case "omarchy": return omarchyModuleComponent
case "clock": return clockModuleComponent
case "update": return updateModuleComponent
case "indicators": return indicatorsModuleComponent
@@ -303,6 +302,7 @@ Item {
// Each entry maps a module id to its display metadata; the QML source is
// loaded asynchronously via Qt.createComponent.
readonly property var firstPartyWidgetMetadata: ({
"omarchy": { displayName: "Omarchy menu", description: "Launches the Omarchy menu", category: "Compositor", allowMultiple: false },
"workspaces": { displayName: "Workspaces", description: "Workspace number indicators", category: "Compositor", allowMultiple: false },
"media": { displayName: "Media", description: "MPRIS now-playing with playback controls", category: "Media", allowMultiple: false },
"audioPanel": { displayName: "Audio", description: "Volume slider, output picker, per-app mixer", category: "Audio", allowMultiple: false, sourceDir: "../panels", sourceName: "Audio" },
@@ -711,7 +711,6 @@ Item {
}
Component { id: emptyModuleComponent; Item { implicitWidth: 0; implicitHeight: 0; visible: false } }
Component { id: omarchyModuleComponent; OmarchyModule {} }
Component { id: clockModuleComponent; ClockModule {} }
Component { id: updateModuleComponent; UpdateModule {} }
Component { id: indicatorsModuleComponent; IndicatorsModule {} }
@@ -1442,16 +1441,6 @@ Item {
}
}
component OmarchyModule: ModuleButton {
text: "\ue900"
fontFamily: "omarchy"
horizontalMargin: 7.5
onPressed: function(button) {
if (button === Qt.RightButton) root.run("xdg-terminal-exec")
else root.run("omarchy-shell menu toggle root")
}
}
component ClockModule: ModuleButton {
text: root.clockText()
horizontalMargin: 8.75
+2 -1
View File
@@ -54,6 +54,7 @@ Example `shell.json` (bar subtree only shown):
| Name | What it does | Interactions |
|---|---|---|
| `omarchy` | Omarchy menu launcher | left = menu · right = terminal |
| `workspaces` | Hyprland workspace switcher | left = focus workspace |
| `media` | MPRIS now-playing — scrolling track + artist, cover-art popup | left = play/pause · middle = next · scroll = prev/next · right = popup |
| `daytime` | Day/time label with date tooltip | hover = date |
@@ -74,7 +75,7 @@ Example `shell.json` (bar subtree only shown):
### Built-in base modules (in `Bar.qml`)
`omarchy`, `clock`, `update`, `indicators`, `tray`.
`clock`, `update`, `indicators`, `tray`.
The `indicators` module loads individual bar indicators from `indicators/`, ordered by its `items` array in `shell.json`. Rich panels such as `powerPanel`, `networkPanel`, and `audioPanel` live in `../panels/` above.
+24
View File
@@ -0,0 +1,24 @@
import QtQuick
import qs.Ui
BarWidget {
id: root
moduleName: "omarchy"
implicitWidth: button.implicitWidth
implicitHeight: button.implicitHeight
WidgetButton {
id: button
anchors.fill: parent
bar: root.bar
text: "\ue900"
fontFamily: "omarchy"
horizontalMargin: 7.5
onPressed: function(button) {
if (!root.bar) return
if (button === Qt.RightButton) root.bar.run("xdg-terminal-exec")
else root.bar.run("omarchy-shell menu toggle root")
}
}
}
-1
View File
@@ -291,7 +291,6 @@ Item {
// ---------------- widget catalog -----------------------------------------
readonly property var builtinWidgetMeta: ({
"omarchy": { name: "Omarchy menu", description: "Launches the Omarchy menu", category: "Compositor" },
"clock": { name: "Clock", description: "Date / time text", category: "Time" },
"update": { name: "Updates", description: "Indicates available system updates", category: "System" },
"indicators": { name: "Indicators", description: "Manual state indicators", category: "Status" },