1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-07 14:08:29 -04:00

fix(dash-tabs): update visibility logic for dash tab elements

Fixes #2822

Port 1.5
This commit is contained in:
purian23
2026-07-12 23:57:29 -04:00
parent 4ab03deded
commit f590a2965a
3 changed files with 8 additions and 5 deletions
+2 -1
View File
@@ -617,7 +617,8 @@ Singleton {
function setDashTabEnabled(id, on) { function setDashTabEnabled(id, on) {
const current = getDashTabs(); const current = getDashTabs();
if (!on && id !== "settings" && current.filter(t => t.enabled && t.id !== "settings").length <= 1) const visibleContentIds = visibleDashTabIds().filter(tabId => tabId !== "settings");
if (!on && visibleContentIds.indexOf(id) >= 0 && visibleContentIds.length <= 1)
return; return;
dashTabs = current.map(t => t.id === id ? { dashTabs = current.map(t => t.id === id ? {
"id": t.id, "id": t.id,
@@ -323,7 +323,8 @@ DankPopout {
id: tabBar id: tabBar
width: parent.width width: parent.width
height: 48 height: visible ? 48 : 0
visible: model.length > 0
currentIndex: root.currentTabIndex currentIndex: root.currentTabIndex
spacing: Theme.spacingS spacing: Theme.spacingS
equalWidthTabs: true equalWidthTabs: true
@@ -355,7 +356,8 @@ DankPopout {
Item { Item {
width: parent.width width: parent.width
height: Theme.spacingXS height: visible ? Theme.spacingXS : 0
visible: tabBar.visible
} }
Item { Item {
+2 -2
View File
@@ -48,7 +48,7 @@ Item {
// its delegates alive across commits (preserving focus for keyboard reorder) // its delegates alive across commits (preserving focus for keyboard reorder)
readonly property var tabIds: SettingsData._dashTabIds readonly property var tabIds: SettingsData._dashTabIds
readonly property var tabState: SettingsData.getDashTabs() readonly property var tabState: SettingsData.getDashTabs()
readonly property int enabledContentCount: tabState.filter(t => t.enabled && t.id !== "settings").length readonly property var visibleContentIds: SettingsData.visibleDashTabIds().filter(id => id !== "settings")
function presentationFor(id) { function presentationFor(id) {
return __presentation[id] ?? { return __presentation[id] ?? {
@@ -149,7 +149,7 @@ Item {
} }
function canHide(id) { function canHide(id) {
return !isEnabled(id) || id === "settings" || enabledContentCount > 1; return !isEnabled(id) || id === "settings" || visibleContentIds.indexOf(id) < 0 || visibleContentIds.length > 1;
} }
// Keyboard nav is handled at the tab root (not per-row activeFocusOnTab) // Keyboard nav is handled at the tab root (not per-row activeFocusOnTab)