From 959190dcbc9af227599008b8cfdd06bdb7275aa6 Mon Sep 17 00:00:00 2001 From: purian23 Date: Fri, 20 Mar 2026 00:38:34 -0400 Subject: [PATCH] feat(Settings): Add sidebar state management on categories --- quickshell/Common/SessionData.qml | 8 ++++++++ quickshell/Common/settings/SessionSpec.js | 5 ++++- quickshell/Modals/Settings/SettingsSidebar.qml | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/quickshell/Common/SessionData.qml b/quickshell/Common/SessionData.qml index e8537300..5efa7a03 100644 --- a/quickshell/Common/SessionData.qml +++ b/quickshell/Common/SessionData.qml @@ -134,6 +134,8 @@ Singleton { property string launcherLastMode: "all" property string appDrawerLastMode: "apps" property string niriOverviewLastMode: "apps" + property string settingsSidebarExpandedIds: "," + property string settingsSidebarCollapsedIds: "," Component.onCompleted: { if (!isGreeterMode) { @@ -1104,6 +1106,12 @@ Singleton { saveSettings(); } + function setSettingsSidebarState(expandedIds, collapsedIds) { + settingsSidebarExpandedIds = expandedIds; + settingsSidebarCollapsedIds = collapsedIds; + saveSettings(); + } + function syncWallpaperForCurrentMode() { if (!perModeWallpaper) return; diff --git a/quickshell/Common/settings/SessionSpec.js b/quickshell/Common/settings/SessionSpec.js index 69af83d5..ae1a9cce 100644 --- a/quickshell/Common/settings/SessionSpec.js +++ b/quickshell/Common/settings/SessionSpec.js @@ -84,7 +84,10 @@ var SPEC = { launcherLastMode: { def: "all" }, appDrawerLastMode: { def: "apps" }, - niriOverviewLastMode: { def: "apps" } + niriOverviewLastMode: { def: "apps" }, + + settingsSidebarExpandedIds: { def: "," }, + settingsSidebarCollapsedIds: { def: "," } }; function getValidKeys() { diff --git a/quickshell/Modals/Settings/SettingsSidebar.qml b/quickshell/Modals/Settings/SettingsSidebar.qml index 221a4129..50ba2d81 100644 --- a/quickshell/Modals/Settings/SettingsSidebar.qml +++ b/quickshell/Modals/Settings/SettingsSidebar.qml @@ -370,6 +370,7 @@ Rectangle { if (_collapsedIds.indexOf(marker) < 0) _collapsedIds = _collapsedIds + id + ","; } + SessionData.setSettingsSidebarState(_expandedIds, _collapsedIds); } function _setAutoExpanded(id, value) { @@ -538,6 +539,11 @@ Rectangle { color: Theme.surfaceContainer radius: Theme.cornerRadius + Component.onCompleted: { + root._expandedIds = SessionData.settingsSidebarExpandedIds; + root._collapsedIds = SessionData.settingsSidebarCollapsedIds; + } + StyledTextMetrics { id: __m1 font.pixelSize: Theme.fontSizeMedium