bar/workspaces: add option for ws name capitalisation (#543)
This commit is contained in:
parent
42f0f317ca
commit
1d5360d3f3
2 changed files with 10 additions and 2 deletions
|
|
@ -61,9 +61,10 @@ JsonObject {
|
||||||
property bool showWindowsOnSpecialWorkspaces: showWindows
|
property bool showWindowsOnSpecialWorkspaces: showWindows
|
||||||
property bool activeTrail: false
|
property bool activeTrail: false
|
||||||
property bool perMonitorWorkspaces: true
|
property bool perMonitorWorkspaces: true
|
||||||
property string label: " "
|
property string label: " " // if empty, will show workspace name's first letter
|
||||||
property string occupiedLabel: ""
|
property string occupiedLabel: ""
|
||||||
property string activeLabel: ""
|
property string activeLabel: ""
|
||||||
|
property string capitalisation: "preserve" // upper, lower, or preserve - relevant only if label is empty
|
||||||
}
|
}
|
||||||
|
|
||||||
component Tray: JsonObject {
|
component Tray: JsonObject {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,14 @@ ColumnLayout {
|
||||||
animate: true
|
animate: true
|
||||||
text: {
|
text: {
|
||||||
const ws = Hypr.workspaces.values.find(w => w.id === root.ws);
|
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 occupiedLabel = Config.bar.workspaces.occupiedLabel || label;
|
||||||
const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label);
|
const activeLabel = Config.bar.workspaces.activeLabel || (root.isOccupied ? occupiedLabel : label);
|
||||||
return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label;
|
return root.activeWsId === root.ws ? activeLabel : root.isOccupied ? occupiedLabel : label;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue