feat(dash): restore optional settings shortcut in the tab bar

Port 2.0
This commit is contained in:
purian23 committed 2026-10-28 15:48:53 -04:00
1 parent 197f4b1faa
commit 2af1c4c1a0
7 files changed
+50 -14

No files matched your search

Generated
+3 -3
View File
@@ -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": {
+4
View File
@@ -522,6 +522,10 @@ Singleton {
{
"id": "notifications",
"enabled": false
},
{
"id": "settings",
"enabled": false
}
]
property string dashTabPosition: Spec.SPEC.dashTabPosition.def
@@ -881,6 +881,10 @@ var LOCAL_SPEC = {
{
id: "notifications",
enabled: false
},
{
id: "settings",
enabled: false
}
]
},
+19 -5
View File
@@ -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;
}
}
+18 -5
View File
@@ -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);
}
+1
View File
@@ -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)
}