commit 04cb3149679330a27f28e8e35d8617ef86720b90 Author: Andre Padez Date: Sat Aug 15 22:45:52 2026 +0100 Baseline: omarchy.workspaces as shipped Workspaces.qml exactly as it ships in omarchy-dev 4.0.0.r1744.gf002044 (shell/plugins/bar/widgets/), alongside the manifest that `omarchy plugin clone` generates — upstream has no per-widget manifest, the widgets share the shell's registry. Kept on its own branch so `git diff stock..master` shows precisely what this fork changes, and so a future Omarchy release can be dropped onto this branch and merged. diff --git a/Workspaces.qml b/Workspaces.qml new file mode 100644 index 0000000..ec0482a --- /dev/null +++ b/Workspaces.qml @@ -0,0 +1,72 @@ +import QtQuick +import QtQuick.Layouts +import Quickshell.Hyprland +import qs.Commons +import qs.Ui + +BarWidget { + id: root + moduleName: "omarchy.workspaces" + + function workspaceById(id) { + var values = Hyprland.workspaces.values + for (var i = 0; i < values.length; i++) { + if (values[i].id === id) return values[i] + } + + return null + } + + function workspaceIds() { + var ids = [1, 2, 3, 4, 5] + var values = Hyprland.workspaces.values + + for (var i = 0; i < values.length; i++) { + var id = values[i].id + if (id > 0 && id <= 10 && ids.indexOf(id) === -1) ids.push(id) + } + + ids.sort(function(left, right) { return left - right }) + return ids + } + + function focusWorkspace(id) { + if (!root.bar) return + root.bar.run("hyprctl dispatch " + Util.shellQuote("hl.dsp.focus({ workspace = \"" + id + "\" })")) + } + + readonly property real trailingGap: root.vertical ? 0 : Style.spaceReal(1.5) + + implicitWidth: grid.implicitWidth + trailingGap + implicitHeight: grid.implicitHeight + + GridLayout { + id: grid + anchors.fill: parent + anchors.rightMargin: root.trailingGap + columns: root.vertical ? 1 : root.workspaceIds().length + columnSpacing: root.vertical ? 0 : Style.space(1) + rowSpacing: root.vertical ? Style.space(2) : 0 + + Repeater { + model: root.workspaceIds() + + WidgetButton { + required property int modelData + + readonly property var workspace: root.workspaceById(modelData) + readonly property bool occupied: workspace !== null && workspace.toplevels.values.length > 0 + readonly property bool focused: Hyprland.focusedWorkspace !== null && Hyprland.focusedWorkspace.id === modelData + + bar: root.bar + text: focused ? "\uDB85\uDCFB" : (modelData === 10 ? "0" : String(modelData)) + opacity: occupied || focused ? 1 : 0.5 + horizontalMargin: 6 + verticalPadding: 6 + fixedWidth: root.vertical ? root.barSize : Style.space(20) + fixedHeight: root.barSize + onPressed: function() { root.focusWorkspace(modelData) } + } + } + } +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..c9e0033 --- /dev/null +++ b/manifest.json @@ -0,0 +1,23 @@ +{ + "schemaVersion": 1, + "id": "pastilhas.workspaces", + "name": "Workspaces", + "version": "1.0.0", + "author": "pastilhas", + "description": "Workspace number indicators", + "kinds": [ + "bar-widget" + ], + "entryPoints": { + "barWidget": "Workspaces.qml" + }, + "barWidget": { + "displayName": "Workspaces", + "description": "Workspace number indicators", + "category": "Compositor", + "allowMultiple": false + }, + "omarchy": { + "clonedFrom": "omarchy.workspaces" + } +}