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

+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)
}