From 2af1c4c1a021d163663a67cdceef2d7bb29d89e5 Mon Sep 17 00:00:00 2001 From: purian23 Date: Wed, 28 Oct 2026 15:48:53 -0400 Subject: [PATCH] feat(dash): restore optional settings shortcut in the tab bar Port 2.0 --- dux-qml-common | 2 +- flake.lock | 6 +++--- quickshell/Common/SettingsData.qml | 4 ++++ quickshell/Common/settings/SettingsSpec.js | 4 ++++ quickshell/Modules/DDash/DDashPopout.qml | 24 +++++++++++++++++----- quickshell/Modules/DDash/DashRegistry.qml | 23 ++++++++++++++++----- quickshell/Modules/Settings/DDashTab.qml | 1 + 7 files changed, 50 insertions(+), 14 deletions(-) diff --git a/dux-qml-common b/dux-qml-common index f02b27a8d..f1c3e1dec 160000 --- a/dux-qml-common +++ b/dux-qml-common @@ -1 +1 @@ -Subproject commit f02b27a8dfaeda39ebe6db1b74eb1a34402b315e +Subproject commit f1c3e1dec547b051f9490d54d89770e90a6270ba diff --git a/flake.lock b/flake.lock index fcb25ce1c..fe21d9d84 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "dank-qml-common": { "flake": false, "locked": { - "lastModified": 1793211648, - "narHash": "sha256-oEm1kiv6KbOLNcNoPPzTNp3PcI3ZopdiZZ9U6m7nNLA=", + "lastModified": 1793216848, + "narHash": "sha256-EpHDdsF/PZq370xCGSceSx49UqM8Hj+XTfGiBmbMfCE=", "owner": "duxlabs-dev", "repo": "dux-qml-common", - "rev": "f02b27a8dfaeda39ebe6db1b74eb1a34402b315e", + "rev": "f1c3e1dec547b051f9490d54d89770e90a6270ba", "type": "github" }, "original": { diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index 4f5fbf025..1b30f35d4 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -522,6 +522,10 @@ Singleton { { "id": "notifications", "enabled": false + }, + { + "id": "settings", + "enabled": false } ] property string dashTabPosition: Spec.SPEC.dashTabPosition.def diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index cf115b8ac..0b9132836 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -881,6 +881,10 @@ var LOCAL_SPEC = { { id: "notifications", enabled: false + }, + { + id: "settings", + enabled: false } ] }, diff --git a/quickshell/Modules/DDash/DDashPopout.qml b/quickshell/Modules/DDash/DDashPopout.qml index 81874bbe6..e17c3d329 100644 --- a/quickshell/Modules/DDash/DDashPopout.qml +++ b/quickshell/Modules/DDash/DDashPopout.qml @@ -53,8 +53,9 @@ DPopout { readonly property string activeTabId: detailTabId !== "" ? detailTabId : currentTabId readonly property var detailEntry: detailTabId !== "" ? DashRegistry.entry(detailTabId) : null readonly property var orderedTabIds: DashRegistry.visibleTabIds - readonly property int currentTabIndex: orderedTabIds.indexOf(currentTabId) - readonly property bool showTabs: orderedTabIds.length > 1 && currentTabIndex >= 0 && detailTabId === "" + readonly property var navigationIds: DashRegistry.navigationIds + readonly property int currentTabIndex: navigationIds.indexOf(currentTabId) + readonly property bool showTabs: navigationIds.length > 1 && currentTabIndex >= 0 && detailTabId === "" readonly property bool canReturn: detailTabId !== "" && currentTabIndex >= 0 readonly property bool showHeader: detailTabId === "" || editMode readonly property int navigationEdge: { @@ -110,6 +111,14 @@ DPopout { currentTabId = DashRegistry.defaultTabId; } + function runAction(id) { + if (id !== "settings") + return; + dashVisible = false; + instantClose(); + PopoutService.focusOrToggleSettings(); + } + function closeDetail() { if (!canReturn) { dashVisible = false; @@ -630,9 +639,14 @@ DPopout { previousFocusTarget: pages.currentItem?.previousFocusTarget ?? pages.focusTarget model: DashRegistry.tabBarModel onActivated: index => { - const id = root.orderedTabIds[index]; - if (id !== undefined) - root.currentTabId = id; + const id = root.navigationIds[index]; + if (id === undefined) + return; + if (DashRegistry.isAction(id)) { + root.runAction(id); + return; + } + root.currentTabId = id; } } diff --git a/quickshell/Modules/DDash/DashRegistry.qml b/quickshell/Modules/DDash/DashRegistry.qml index 407e82830..5449c7330 100644 --- a/quickshell/Modules/DDash/DashRegistry.qml +++ b/quickshell/Modules/DDash/DashRegistry.qml @@ -218,6 +218,13 @@ Singleton { "minH": 2 } }, + { + "id": "settings", + "text": I18n.tr("Settings"), + "icon": "settings", + "description": I18n.tr("Opens %1", "dashboard tab description, %1 is the settings window name").arg(I18n.tr("Settings")), + "action": true + }, { "id": "clock", "text": I18n.tr("Clock"), @@ -436,7 +443,7 @@ Singleton { } readonly property var tabEntries: { - const known = entries.filter(e => e.tab); + const known = entries.filter(e => e.tab || e.action); const result = []; const seen = {}; for (const tab of SettingsData.getDashTabs()) { @@ -457,14 +464,16 @@ Singleton { } return result; } - readonly property var tabIds: tabEntries.filter(e => e.available !== false).map(e => e.id) + readonly property var tabIds: tabEntries.filter(e => !e.action && e.available !== false).map(e => e.id) readonly property int widestPanelColumns: Math.max(DashMetrics.defaultGridColumns, ...tabIds.map(id => DashMetrics.panelColumnsFor(id))) - readonly property var visibleTabIds: tabEntries.filter(e => e.available !== false && e.enabled).map(e => e.id) - readonly property var tabBarModel: visibleTabIds.map(id => { + readonly property var navigationIds: tabEntries.filter(e => e.available !== false && e.enabled).map(e => e.id) + readonly property var visibleTabIds: tabEntries.filter(e => !e.action && e.available !== false && e.enabled).map(e => e.id) + readonly property var tabBarModel: navigationIds.map(id => { const e = entry(id); return { "icon": e.icon, - "text": e.text + "text": e.text, + "action": e.action === true }; }) @@ -641,6 +650,10 @@ Singleton { return entries.find(e => e.id === id) ?? null; } + function isAction(id) { + return entry(id)?.action === true; + } + function hasTab(id) { return tabIds.includes(id); } diff --git a/quickshell/Modules/Settings/DDashTab.qml b/quickshell/Modules/Settings/DDashTab.qml index 32eab29a6..81ce22ff5 100644 --- a/quickshell/Modules/Settings/DDashTab.qml +++ b/quickshell/Modules/Settings/DDashTab.qml @@ -153,6 +153,7 @@ FocusScope { iconName: "edit" tooltipText: I18n.tr("Edit") Accessible.description: tabRow.modelData.text + visible: !tabRow.modelData.action enabled: tabRow.available onClicked: PopoutService.openDankDashEditor(tabRow.modelData.id, root.Window.window?.screen) }