From fa3d02552abde1d981e475beb61744ba9c62dfe2 Mon Sep 17 00:00:00 2001 From: amadoabad Date: Sun, 20 Jul 2025 00:03:39 +0300 Subject: [PATCH] Added number indexing option for the workspace switcher --- Common/Prefs.qml | 10 ++++++++++ Modules/SettingsPopup.qml | 9 +++++++++ Modules/TopBar/WorkspaceSwitcher.qml | 12 +++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Common/Prefs.qml b/Common/Prefs.qml index 76bd0a00..d39fe175 100644 --- a/Common/Prefs.qml +++ b/Common/Prefs.qml @@ -31,6 +31,8 @@ Singleton { property bool showClipboard: true property bool showSystemResources: true property bool showSystemTray: true + // WorkspaceSwitcher index toggle + property bool showWorkspaceIndex: true // View mode preferences for launchers property string appLauncherViewMode: "list" property string spotlightLauncherViewMode: "list" @@ -62,6 +64,7 @@ Singleton { showClipboard = settings.showClipboard !== undefined ? settings.showClipboard : true; showSystemResources = settings.showSystemResources !== undefined ? settings.showSystemResources : true; showSystemTray = settings.showSystemTray !== undefined ? settings.showSystemTray : true; + showWorkspaceIndex = settings.showWorkspaceIndex !== undefined ? settings.showWorkspaceIndex : true; appLauncherViewMode = settings.appLauncherViewMode !== undefined ? settings.appLauncherViewMode : "list"; spotlightLauncherViewMode = settings.spotlightLauncherViewMode !== undefined ? settings.spotlightLauncherViewMode : "list"; networkPreference = settings.networkPreference !== undefined ? settings.networkPreference : "auto"; @@ -96,6 +99,7 @@ Singleton { "showClipboard": showClipboard, "showSystemResources": showSystemResources, "showSystemTray": showSystemTray, + "showWorkspaceIndex": showWorkspaceIndex, "appLauncherViewMode": appLauncherViewMode, "spotlightLauncherViewMode": spotlightLauncherViewMode, "networkPreference": networkPreference @@ -103,6 +107,12 @@ Singleton { console.log("Saving settings - themeIndex:", themeIndex, "isDynamic:", themeIsDynamic, "lightMode:", isLightMode, "transparency:", topBarTransparency, "recentApps:", recentlyUsedApps.length); } + function setShowWorkspaceIndex(enabled) { + console.log("Prefs setShowWorkspaceIndex called - showWorkspaceIndex:", enabled); + showWorkspaceIndex = enabled; + saveSettings(); + } + function applyStoredTheme() { console.log("Applying stored theme:", themeIndex, themeIsDynamic, "lightMode:", isLightMode); if (typeof Theme !== "undefined") { diff --git a/Modules/SettingsPopup.qml b/Modules/SettingsPopup.qml index b19d38f2..3f4a558d 100644 --- a/Modules/SettingsPopup.qml +++ b/Modules/SettingsPopup.qml @@ -489,6 +489,15 @@ PanelWindow { } } + SettingsToggle { + text: "Workspace Index Numbers" + description: "Show workspace index numbers in the top bar workspace switcher" + checked: Prefs.showWorkspaceIndex + onToggled: (checked) => { + return Prefs.setShowWorkspaceIndex(checked); + } + } + } } diff --git a/Modules/TopBar/WorkspaceSwitcher.qml b/Modules/TopBar/WorkspaceSwitcher.qml index dcfab3aa..ff598f5b 100644 --- a/Modules/TopBar/WorkspaceSwitcher.qml +++ b/Modules/TopBar/WorkspaceSwitcher.qml @@ -84,7 +84,7 @@ Rectangle { property int sequentialNumber: index + 1 width: isActive ? Theme.spacingXL + Theme.spacingM : Theme.spacingL + Theme.spacingXS - height: Theme.spacingM + height: Theme.spacingL radius: height / 2 color: isActive ? Theme.primary : isHovered ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.5) : Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.3) @@ -99,6 +99,16 @@ Rectangle { } } + // Only show index if enabled in preferences + Text { + visible: Prefs.showWorkspaceIndex + anchors.centerIn: parent + text: sequentialNumber + color: Theme.surfaceText + font.pixelSize: Theme.fontSizeMedium + font.bold: isActive + } + Behavior on width { NumberAnimation { duration: Theme.mediumDuration