Fix theme swatches, bar sizing, and show 9 workspaces
Claude-Session: https://claude.ai/code/session_014ADhvRXuiTvrXSbConxUey
This commit is contained in:
+13
-1
@@ -11,7 +11,7 @@ Ported from the old `waybar/config.jsonc`, section for section:
|
||||
| Old waybar module | shell.json widget |
|
||||
| --- | --- |
|
||||
| `custom/omarchy` | `omarchy.menu` |
|
||||
| `hyprland/workspaces` | `omarchy.workspaces` |
|
||||
| `hyprland/workspaces` | `blob.workspaces` (cloned plugin) |
|
||||
| `clock` | `blob.clock` (custom module) |
|
||||
| `custom/update` | `omarchy.system-update` |
|
||||
| `custom/voxtype` | `omarchy.indicators` -> `Dictation` |
|
||||
@@ -48,6 +48,18 @@ AGS entry points survive the move off waybar:
|
||||
A command module with no `exec` key is a static icon; add `exec` and
|
||||
`interval` for one that refreshes its own text.
|
||||
|
||||
## Cloned plugins
|
||||
|
||||
`plugins/blob.workspaces/` is a clone of `omarchy.workspaces`, made with
|
||||
`omarchy plugin clone`. The stock widget hardcodes workspaces 1-5 as always
|
||||
visible and has no setting for it, so the clone changes that list to 1-9 to
|
||||
match the old waybar `persistent-workspaces`. Cloning also switches the bar
|
||||
to the cloned id, which is why `shell.json` says `blob.workspaces`.
|
||||
|
||||
Re-clone after an Omarchy update if the upstream widget gains something worth
|
||||
picking up: `omarchy plugin clone omarchy.workspaces`, then re-apply the
|
||||
one-line `workspaceIds()` change.
|
||||
|
||||
## Editing
|
||||
|
||||
Dragging widgets in the bar rewrites `~/.config/omarchy/shell.json` directly.
|
||||
|
||||
@@ -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, 6, 7, 8, 9]
|
||||
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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "blob.workspaces",
|
||||
"name": "My Workspaces",
|
||||
"version": "1.0.0",
|
||||
"author": "Omarchy",
|
||||
"description": "Workspace number indicators",
|
||||
"kinds": [
|
||||
"bar-widget"
|
||||
],
|
||||
"entryPoints": {
|
||||
"barWidget": "Workspaces.qml"
|
||||
},
|
||||
"barWidget": {
|
||||
"displayName": "My Workspaces",
|
||||
"description": "Workspace number indicators",
|
||||
"category": "Compositor",
|
||||
"allowMultiple": false
|
||||
},
|
||||
"omarchy": {
|
||||
"clonedFrom": "omarchy.workspaces"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
"id": "omarchy.menu"
|
||||
},
|
||||
{
|
||||
"id": "omarchy.workspaces"
|
||||
"id": "blob.workspaces"
|
||||
}
|
||||
],
|
||||
"center": [
|
||||
|
||||
Reference in New Issue
Block a user