diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index fed8ba97..952ae9cd 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -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 diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index 060a681e..15916616 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -81,6 +81,7 @@ var SPEC = { ]}, showWorkspaceIndex: { def: false }, + showWorkspaceName: { def: false }, showWorkspacePadding: { def: false }, workspaceScrolling: { def: false }, showWorkspaceApps: { def: false }, diff --git a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml index 110e180e..a31caafe 100644 --- a/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml +++ b/quickshell/Modules/DankBar/Widgets/WorkspaceSwitcher.qml @@ -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 diff --git a/quickshell/Modules/Settings/WorkspacesTab.qml b/quickshell/Modules/Settings/WorkspacesTab.qml index db464e5c..0b56bab5 100644 --- a/quickshell/Modules/Settings/WorkspacesTab.qml +++ b/quickshell/Modules/Settings/WorkspacesTab.qml @@ -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"] diff --git a/quickshell/translations/settings_search_index.json b/quickshell/translations/settings_search_index.json index fa9d8c32..e6885e7a 100644 --- a/quickshell/translations/settings_search_index.json +++ b/quickshell/translations/settings_search_index.json @@ -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",