Shrink the workspace list and label each with its shortcut digit

Twenty workspaces plus dividers was ~912px of bar.

- Label each workspace with `id % 10`, so 11-15 read "1 2 3 4 5", 1-10 read
  "1 2 3 4 5 6 7 8 9 0" and 16-20 read "6 7 8 9 0". Beyond the width this
  buys, it makes the label the key you press: the bindings are SUPER+<n> for
  1-10, SUPER+CTRL+1..5 for 11-15 and SUPER+CTRL+6..0 for 16-20, so the
  digit shown is the digit in that workspace's shortcut.

- Narrow the buttons to space(13) now every label is one character, drop the
  inter-button spacing to 0, and set the font a step below body. The group
  dividers keep their wider gaps — that separation is what distinguishes the
  three monitors.

Net ~560px, down from ~912px.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-17 17:32:39 +01:00
co-authored by Claude Opus 5
parent e05733448a
commit a8b49abd4b
+15 -7
View File
@@ -99,8 +99,8 @@ BarWidget {
// added on each side of a group divider. The divider sits in the same
// GridLayout as the buttons, so without this it would inherit the ordinary
// inter-button spacing and the three groups would read as one run.
readonly property real itemSpacing: Style.space(1)
readonly property real groupGap: itemSpacing * 4
readonly property real itemSpacing: 0
readonly property real groupGap: Style.space(5)
implicitWidth: grid.implicitWidth + trailingGap
implicitHeight: grid.implicitHeight
@@ -149,14 +149,22 @@ BarWidget {
readonly property bool focused: Hyprland.focusedWorkspace !== null && Hyprland.focusedWorkspace.id === wsId
bar: root.bar
// Stock rendered 10 as "0" to keep every label one character. With
// 11-20 alongside it, two-digit labels are the norm, so 10 is shown
// as itself.
text: focused ? "󱓻" : String(wsId)
// Single digit per workspace: id mod 10, so 11-15 read "1 2 3 4 5",
// 1-10 read "1 2 3 4 5 6 7 8 9 0", and 16-20 read "6 7 8 9 0".
//
// That is not just for width — it makes the label the key you press.
// The bindings in ~/.config/hypr/bindings.lua are SUPER+<n> for 1-10,
// SUPER+CTRL+1..5 for 11-15 and SUPER+CTRL+6..0 for 16-20, so the
// digit shown is the digit in the shortcut for that workspace.
text: focused ? "󱓻" : String(wsId % 10)
opacity: occupied || focused ? 1 : 0.5
horizontalMargin: 6
verticalPadding: 6
fixedWidth: root.vertical ? root.barSize : Style.space(22)
// Twenty workspaces plus dividers is a lot of bar. Every label is a
// single character now, so these can be narrower still than the
// stock space(20), with a font a step below body.
fontSize: Style.font.bodySmall
fixedWidth: root.vertical ? root.barSize : Style.space(13)
fixedHeight: root.barSize
onPressed: function() { root.focusWorkspace(wsId) }
}