make right sidebar tab persistent

This commit is contained in:
end-4
2025-05-10 23:42:28 +02:00
parent f13912a027
commit 3c877197b4
5 changed files with 32 additions and 12 deletions
@@ -5,8 +5,12 @@ pragma ComponentBehavior: Bound
Singleton {
property QtObject sidebar: QtObject {
property QtObject centerGroup: QtObject {
property int selectedTab: 0
}
property QtObject bottomGroup: QtObject {
property bool collapsed: false
property int selectedTab: 0
}
}
@@ -7,6 +7,7 @@ import Quickshell
ColumnLayout {
id: root
spacing: 0
property bool _initialized: false
required property var tabButtonList // Something like [{"icon": "notifications", "name": qsTr("Notifications")}, {"icon": "volume_up", "name": qsTr("Volume mixer")}]
required property var externalTrackedTab
property bool enableIndicatorAnimation: false
@@ -16,7 +17,13 @@ ColumnLayout {
id: tabBar
Layout.fillWidth: true
currentIndex: root.externalTrackedTab
onCurrentIndexChanged: root.onCurrentIndexChanged(currentIndex)
onCurrentIndexChanged: {
if (!root._initialized) {
root._initialized = true
return
}
root.onCurrentIndexChanged(currentIndex)
}
background: Item {
WheelHandler {