Workspace: ShowLabel replaced toggle by NComboBox so we can choose "Name" or "Index"

This commit is contained in:
LemmyCook 2025-08-26 20:55:45 -04:00
parent 94e59592f0
commit dd456edf90
3 changed files with 25 additions and 11 deletions

View file

@ -122,7 +122,7 @@ Singleton {
property bool showActiveWindowIcon: true
property bool alwaysShowBatteryPercentage: false
property real backgroundOpacity: 1.0
property bool showWorkspacesNames: false
property string showWorkspaceLabel: "none"
property list<string> monitors: []
// Widget configuration for modular bar system

View file

@ -152,7 +152,7 @@ Item {
model: localWorkspaces
Item {
id: workspacePillContainer
height: Settings.data.bar.showWorkspacesNames ? 18 * scaling : 14 * scaling
height: (Settings.data.bar.showWorkspaceLabel !== "none") ? 18 * scaling : 14 * scaling
width: root.calculatedWsWidth(model)
Rectangle {
@ -160,7 +160,7 @@ Item {
anchors.fill: parent
Loader {
active: Settings.data.bar.showWorkspacesNames
active: (Settings.data.bar.showWorkspaceLabel !== "none")
sourceComponent: Component {
Text {
// Center horizontally
@ -168,7 +168,7 @@ Item {
// Center vertically accounting for font metrics
y: (pill.height - height) / 2 + (height - contentHeight) / 2
text: {
if (model.name && model.name.length > 0) {
if (Settings.data.bar.showWorkspaceLabel === "name" && model.name && model.name.length > 0) {
return model.name.substring(0, 2)
} else {
return model.idx.toString()

View file

@ -128,13 +128,27 @@ ColumnLayout {
}
}
NToggle {
label: "Show Workspaces Names"
description: "Display the workspace name in the workspace indicator"
checked: Settings.data.bar.showWorkspacesNames
onToggled: checked => {
Settings.data.bar.showWorkspacesNames = checked
}
NComboBox {
label: "Show Workspaces Labels"
description: "Display the workspace name or index in the workspace indicator"
model: ListModel {
ListElement {
key: "none"
name: "None"
}
ListElement {
key: "index"
name: "Index"
}
ListElement {
key: "name"
name: "Name"
}
}
currentKey: Settings.data.bar.showWorkspaceLabel
onSelected: key => {
Settings.data.bar.showWorkspaceLabel = key
}
}
NDivider {