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 showActiveWindowIcon: true
property bool alwaysShowBatteryPercentage: false property bool alwaysShowBatteryPercentage: false
property real backgroundOpacity: 1.0 property real backgroundOpacity: 1.0
property bool showWorkspacesNames: false property string showWorkspaceLabel: "none"
property list<string> monitors: [] property list<string> monitors: []
// Widget configuration for modular bar system // Widget configuration for modular bar system

View file

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

View file

@ -128,12 +128,26 @@ ColumnLayout {
} }
} }
NToggle { NComboBox {
label: "Show Workspaces Names" label: "Show Workspaces Labels"
description: "Display the workspace name in the workspace indicator" description: "Display the workspace name or index in the workspace indicator"
checked: Settings.data.bar.showWorkspacesNames model: ListModel {
onToggled: checked => { ListElement {
Settings.data.bar.showWorkspacesNames = checked 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
} }
} }