From 1d5360d3f33f5148387e89970a9cc94f63b65e40 Mon Sep 17 00:00:00 2001 From: sweenu Date: Mon, 1 Sep 2025 13:47:10 +0200 Subject: bar/workspaces: add option for ws name capitalisation (#543) --- config/BarConfig.qml | 3 ++- modules/bar/components/workspaces/Workspace.qml | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/BarConfig.qml b/config/BarConfig.qml index b8d83e6..1f9db70 100644 --- a/config/BarConfig.qml +++ b/config/BarConfig.qml @@ -61,9 +61,10 @@ JsonObject { property bool showWindowsOnSpecialWorkspaces: showWindows property bool activeTrail: false property bool perMonitorWorkspaces: true - property string label: " " + property string label: " " // if empty, will show workspace name's first letter property string occupiedLabel: "󰮯" property string activeLabel: "󰮯" + property string capitalisation: "preserve" // upper, lower, or preserve - relevant only if label is empty } component Tray: JsonObject { diff --git a/modules/bar/components/workspaces/Workspace.qml b/modules/bar/components/workspaces/Workspace.qml index b4e6b40..d9d103d 100644 --- a/modules/bar/components/workspaces/Workspace.qml +++ b/modules/bar/components/workspaces/Workspace.qml @@ -36,7 +36,14 @@ ColumnLayout { animate: true text: { const ws = Hypr.workspaces.values.find(w => w.id === root.ws); - const label = Config.bar.workspaces.label || (!ws || ws.name == root.ws ? root.ws : ws.name[0].toUpperCase()); + const wsName = !ws || ws.name == root.ws ? root.ws : ws.name[0]; + let displayName = wsName.toString(); + if (Config.bar.workspaces.capitalisation.toLowerCase() === "upper") { + displayName = displayName.toUpperCase(); + } else if (Config.bar.workspaces.capitalisation.toLowerCase() === "lower") { + displayName = displayName.toLowerCase(); + } + const label = Config.bar.workspaces.label || displayName; const occupiedLabel = Config.bar.workspaces.occupiedLabel || label; const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label); return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label; -- cgit v1.2.3-freya