diff --git a/Commons/Settings.qml b/Commons/Settings.qml index a8f7163..9f51e4b 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -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 monitors: [] // Widget configuration for modular bar system diff --git a/Modules/Bar/Widgets/Workspace.qml b/Modules/Bar/Widgets/Workspace.qml index 057ae08..ab62ab2 100644 --- a/Modules/Bar/Widgets/Workspace.qml +++ b/Modules/Bar/Widgets/Workspace.qml @@ -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() diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index 17bd7c9..8f327b6 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -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 {