From f1fdb941e1e3d71900d7af0f9b619c0c034a5bd1 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 14 Dec 2025 10:47:53 +0100 Subject: [PATCH] persistent cheatsheet tabs (closes #2681) --- .../quickshell/ii/modules/common/Persistent.qml | 4 ++++ .../ii/modules/ii/cheatsheet/Cheatsheet.qml | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/common/Persistent.qml b/dots/.config/quickshell/ii/modules/common/Persistent.qml index 478cadd10..247884028 100644 --- a/dots/.config/quickshell/ii/modules/common/Persistent.qml +++ b/dots/.config/quickshell/ii/modules/common/Persistent.qml @@ -63,6 +63,10 @@ Singleton { property real temperature: 0.5 } + property JsonObject cheatsheet: JsonObject { + property int tabIndex: 0 + } + property JsonObject sidebar: JsonObject { property JsonObject bottomGroup: JsonObject { property bool collapsed: false diff --git a/dots/.config/quickshell/ii/modules/ii/cheatsheet/Cheatsheet.qml b/dots/.config/quickshell/ii/modules/ii/cheatsheet/Cheatsheet.qml index d133fa654..f7fb68f68 100644 --- a/dots/.config/quickshell/ii/modules/ii/cheatsheet/Cheatsheet.qml +++ b/dots/.config/quickshell/ii/modules/ii/cheatsheet/Cheatsheet.qml @@ -4,6 +4,7 @@ import qs.modules.common.widgets import QtQuick import QtQuick.Controls import QtQuick.Layouts +import Qt.labs.synchronizer import Qt5Compat.GraphicalEffects import Quickshell.Io import Quickshell @@ -135,7 +136,10 @@ Scope { // Scope ToolbarTabBar { id: tabBar tabButtonList: root.tabButtonList - currentIndex: swipeView.currentIndex + + Synchronizer on currentIndex { + property alias source: swipeView.currentIndex + } } } @@ -144,8 +148,11 @@ Scope { // Scope Layout.topMargin: 5 Layout.fillWidth: true Layout.fillHeight: true - currentIndex: tabBar.currentIndex spacing: 10 + currentIndex: Persistent.states.cheatsheet.tabIndex + onCurrentIndexChanged: { + Persistent.states.cheatsheet.tabIndex = currentIndex; + } implicitWidth: Math.max.apply(null, contentChildren.map(child => child.implicitWidth || 0)) implicitHeight: Math.max.apply(null, contentChildren.map(child => child.implicitHeight || 0))