diff --git a/.config/quickshell/modules/common/PersistentStates.qml b/.config/quickshell/modules/common/PersistentStates.qml index 4c9a7608..cbf52e8e 100644 --- a/.config/quickshell/modules/common/PersistentStates.qml +++ b/.config/quickshell/modules/common/PersistentStates.qml @@ -9,12 +9,6 @@ Singleton { } property QtObject sidebar: QtObject { - property QtObject leftSide: QtObject { - property int selectedTab: 0 - } - property QtObject centerGroup: QtObject { - property int selectedTab: 0 - } property QtObject bottomGroup: QtObject { property bool collapsed: false property int selectedTab: 0 diff --git a/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml b/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml index 20c1b79e..4c60bdac 100644 --- a/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml +++ b/.config/quickshell/modules/sidebarLeft/SidebarLeft.qml @@ -28,7 +28,7 @@ Scope { // Scope id: sidebarRoot visible: sidebarLoader.active - property int selectedTab: PersistentStates.sidebar.leftSide.selectedTab + property int selectedTab: 0 property bool extend: false property bool pin: false property real sidebarWidth: sidebarRoot.extend ? Appearance.sizes.sidebarWidthExtended : Appearance.sizes.sidebarWidth @@ -88,16 +88,16 @@ Scope { // Scope } if (event.modifiers === Qt.ControlModifier) { if (event.key === Qt.Key_PageDown) { - PersistentStateManager.setState("sidebar.leftSide.selectedTab", Math.min(sidebarRoot.selectedTab + 1, root.tabButtonList.length - 1)) + sidebarRoot.selectedTab = Math.min(sidebarRoot.selectedTab + 1, root.tabButtonList.length - 1) } else if (event.key === Qt.Key_PageUp) { - PersistentStateManager.setState("sidebar.leftSide.selectedTab", Math.max(sidebarRoot.selectedTab - 1, 0)) + sidebarRoot.selectedTab = Math.max(sidebarRoot.selectedTab - 1, 0) } else if (event.key === Qt.Key_Tab) { - PersistentStateManager.setState("sidebar.leftSide.selectedTab", (sidebarRoot.selectedTab + 1) % root.tabButtonList.length); + sidebarRoot.selectedTab = (sidebarRoot.selectedTab + 1) % root.tabButtonList.length; } else if (event.key === Qt.Key_Backtab) { - PersistentStateManager.setState("sidebar.leftSide.selectedTab", (sidebarRoot.selectedTab - 1 + root.tabButtonList.length) % root.tabButtonList.length); + sidebarRoot.selectedTab = (sidebarRoot.selectedTab - 1 + root.tabButtonList.length) % root.tabButtonList.length; } else if (event.key === Qt.Key_O) { sidebarRoot.extend = !sidebarRoot.extend; @@ -120,7 +120,7 @@ Scope { // Scope tabButtonList: root.tabButtonList externalTrackedTab: sidebarRoot.selectedTab function onCurrentIndexChanged(currentIndex) { - PersistentStateManager.setState("sidebar.leftSide.selectedTab", currentIndex) + sidebarRoot.selectedTab = currentIndex } } @@ -130,10 +130,11 @@ Scope { // Scope Layout.fillWidth: true Layout.fillHeight: true spacing: 10 - currentIndex: sidebarRoot.selectedTab + + currentIndex: tabBar.externalTrackedTab onCurrentIndexChanged: { tabBar.enableIndicatorAnimation = true - PersistentStateManager.setState("sidebar.leftSide.selectedTab", currentIndex) + sidebarRoot.selectedTab = currentIndex } clip: true diff --git a/.config/quickshell/modules/sidebarRight/CenterWidgetGroup.qml b/.config/quickshell/modules/sidebarRight/CenterWidgetGroup.qml index bb871993..1b426da4 100644 --- a/.config/quickshell/modules/sidebarRight/CenterWidgetGroup.qml +++ b/.config/quickshell/modules/sidebarRight/CenterWidgetGroup.qml @@ -16,27 +16,23 @@ Rectangle { radius: Appearance.rounding.normal color: Appearance.colors.colLayer1 - property int selectedTab: PersistentStates.sidebar.centerGroup.selectedTab + property int selectedTab: 0 property var tabButtonList: [{"icon": "notifications", "name": qsTr("Notifications")}, {"icon": "volume_up", "name": qsTr("Volume mixer")}] - onSelectedTabChanged: { - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", selectedTab) - } - Keys.onPressed: (event) => { if (event.key === Qt.Key_PageDown || event.key === Qt.Key_PageUp) { if (event.key === Qt.Key_PageDown) { - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", Math.min(root.selectedTab + 1, root.tabButtonList.length - 1)) + root.selectedTab = Math.min(root.selectedTab + 1, root.tabButtonList.length - 1) } else if (event.key === Qt.Key_PageUp) { - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", Math.max(root.selectedTab - 1, 0)) + root.selectedTab = Math.max(root.selectedTab - 1, 0) } event.accepted = true; } if (event.modifiers === Qt.ControlModifier) { if (event.key === Qt.Key_Tab) { - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", (root.selectedTab + 1) % root.tabButtonList.length); + root.selectedTab = (root.selectedTab + 1) % root.tabButtonList.length } else if (event.key === Qt.Key_Backtab) { - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", (root.selectedTab - 1 + root.tabButtonList.length) % root.tabButtonList.length); + root.selectedTab = (root.selectedTab - 1 + root.tabButtonList.length) % root.tabButtonList.length } event.accepted = true; } @@ -53,7 +49,7 @@ Rectangle { externalTrackedTab: root.selectedTab function onCurrentIndexChanged(currentIndex) { - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", currentIndex) + root.selectedTab = currentIndex } } @@ -66,7 +62,7 @@ Rectangle { currentIndex: root.selectedTab onCurrentIndexChanged: { tabBar.enableIndicatorAnimation = true - PersistentStateManager.setState("sidebar.centerGroup.selectedTab", currentIndex) + root.selectedTab = currentIndex } clip: true