1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

bar(ws): add option to show name (#1223)

This commit is contained in:
sweenu
2026-01-02 21:47:33 +01:00
committed by GitHub
parent ba28767492
commit 69b1d0c2da
5 changed files with 48 additions and 4 deletions

View File

@@ -171,6 +171,7 @@ Singleton {
]
property bool showWorkspaceIndex: false
property bool showWorkspaceName: false
property bool showWorkspacePadding: false
property bool workspaceScrolling: false
property bool showWorkspaceApps: false

View File

@@ -81,6 +81,7 @@ var SPEC = {
]},
showWorkspaceIndex: { def: false },
showWorkspaceName: { def: false },
showWorkspacePadding: { def: false },
workspaceScrolling: { def: false },
showWorkspaceApps: { def: false },

View File

@@ -565,6 +565,17 @@ Item {
if (isPlaceholder)
return index + 1;
if (SettingsData.showWorkspaceName) {
let workspaceName = modelData?.name;
if (workspaceName && workspaceName !== "") {
if (root.isVertical) {
return workspaceName.charAt(0);
}
return workspaceName;
}
}
if (root.useExtWorkspace)
return index + 1;
if (CompositorService.isHyprland)
@@ -942,7 +953,7 @@ Item {
id: rowLayout
Row {
spacing: 4
visible: loadedIcons.length > 0 || SettingsData.showWorkspaceIndex || loadedHasIcon
visible: loadedIcons.length > 0 || SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName || loadedHasIcon
Item {
visible: loadedHasIcon && loadedIconData?.type === "icon"
@@ -975,7 +986,7 @@ Item {
}
Item {
visible: SettingsData.showWorkspaceIndex && !loadedHasIcon
visible: (SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon
width: wsIndexText.implicitWidth + (isActive && loadedIcons.length > 0 ? 4 : 0)
height: root.appIconSize
@@ -1072,7 +1083,7 @@ Item {
id: columnLayout
Column {
spacing: 4
visible: loadedIcons.length > 0 || loadedHasIcon
visible: loadedIcons.length > 0 || SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName || loadedHasIcon
DankIcon {
visible: loadedHasIcon && loadedIconData?.type === "icon"
@@ -1209,7 +1220,7 @@ Item {
Loader {
id: indexLoader
anchors.fill: parent
active: SettingsData.showWorkspaceIndex && !loadedHasIcon && !SettingsData.showWorkspaceApps
active: (SettingsData.showWorkspaceIndex || SettingsData.showWorkspaceName) && !loadedHasIcon && !SettingsData.showWorkspaceApps
sourceComponent: Item {
StyledText {
anchors.centerIn: parent

View File

@@ -35,6 +35,15 @@ Item {
onToggled: checked => SettingsData.set("showWorkspaceIndex", checked)
}
SettingsToggleRow {
settingKey: "showWorkspaceName"
tags: ["workspace", "name", "labels"]
text: I18n.tr("Workspace Names")
description: I18n.tr("Show workspace name on horizontal bars, and first letter on vertical bars")
checked: SettingsData.showWorkspaceName
onToggled: checked => SettingsData.set("showWorkspaceName", checked)
}
SettingsToggleRow {
settingKey: "showWorkspacePadding"
tags: ["workspace", "padding", "minimum"]

View File

@@ -871,6 +871,28 @@
],
"description": "Show workspace index numbers in the top bar workspace switcher"
},
{
"section": "showWorkspaceName",
"label": "Workspace Name",
"tabIndex": 4,
"category": "Workspaces",
"keywords": [
"desktop",
"labels",
"panel",
"show",
"spaces",
"statusbar",
"switcher",
"taskbar",
"topbar",
"virtual",
"virtual desktops",
"workspace",
"workspaces"
],
"description": "Show workspace name on horizontal bars, and first letter on vertical bars"
},
{
"section": "showWorkspacePadding",
"label": "Workspace Padding",