From 54c98866275dea0dd0a92ff2d4a3b573b0d87025 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 24 Feb 2026 20:48:42 -0500 Subject: [PATCH] settings: make horizontal change more smart --- quickshell/Modules/Settings/DankBarTab.qml | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/quickshell/Modules/Settings/DankBarTab.qml b/quickshell/Modules/Settings/DankBarTab.qml index 540b9b22..36f9552d 100644 --- a/quickshell/Modules/Settings/DankBarTab.qml +++ b/quickshell/Modules/Settings/DankBarTab.qml @@ -51,9 +51,34 @@ Item { } } + function _isBarActive(c) { + if (!c.enabled) return false; + const prefs = c.screenPreferences || ["all"]; + if (prefs.length > 0) return true; + return (c.showOnLastDisplay ?? true) && Quickshell.screens.length === 1; + } + function notifyHorizontalBarChange() { - if (selectedBarIsVertical) + const configs = SettingsData.barConfigs; + if (configs.length < 2) return; + + const hasHorizontal = configs.some(c => { + if (!_isBarActive(c)) return false; + const p = c.position ?? SettingsData.Position.Top; + return p === SettingsData.Position.Top || p === SettingsData.Position.Bottom; + }); + if (!hasHorizontal) + return; + + const hasVertical = configs.some(c => { + if (!_isBarActive(c)) return false; + const p = c.position ?? SettingsData.Position.Top; + return p === SettingsData.Position.Left || p === SettingsData.Position.Right; + }); + if (!hasVertical) + return; + horizontalBarChangeDebounce.restart(); } @@ -147,6 +172,7 @@ Item { SettingsData.updateBarConfig(barId, { screenPreferences: prefs }); + notifyHorizontalBarChange(); } function getBarShowOnLastDisplay(barId) { @@ -158,6 +184,8 @@ Item { SettingsData.updateBarConfig(barId, { showOnLastDisplay: value }); + if (Quickshell.screens.length === 1) + notifyHorizontalBarChange(); } DankFlickable { @@ -539,13 +567,10 @@ Item { newPos = SettingsData.Position.Right; break; } - const wasVertical = selectedBarIsVertical; SettingsData.updateBarConfig(selectedBarId, { position: newPos }); - const isVertical = newPos === SettingsData.Position.Left || newPos === SettingsData.Position.Right; - if (wasVertical !== isVertical || !isVertical) - notifyHorizontalBarChange(); + notifyHorizontalBarChange(); } } }