forked from Shinonome/dots-hyprland
add automatic restore
This commit is contained in:
@@ -206,6 +206,9 @@ Singleton {
|
||||
property string username: "[unset]"
|
||||
}
|
||||
}
|
||||
property JsonObject bottomWidgetRight: JsonObject {
|
||||
property int lastTab: 0
|
||||
}
|
||||
}
|
||||
|
||||
property JsonObject time: JsonObject {
|
||||
|
||||
@@ -14,7 +14,7 @@ Rectangle {
|
||||
color: Appearance.colors.colLayer1
|
||||
clip: true
|
||||
implicitHeight: collapsed ? collapsedBottomWidgetGroupRow.implicitHeight : bottomWidgetGroupRow.implicitHeight
|
||||
property int selectedTab: 0
|
||||
property int selectedTab: Config.options.sidebar.bottomWidgetRight.lastTab
|
||||
property bool collapsed: Persistent.states.sidebar.bottomGroup.collapsed
|
||||
property var tabs: [
|
||||
{"type": "calendar", "name": "Calendar", "icon": "calendar_month", "widget": calendarWidget},
|
||||
@@ -146,6 +146,7 @@ Rectangle {
|
||||
buttonIcon: modelData.icon
|
||||
onClicked: {
|
||||
root.selectedTab = index
|
||||
Config.options.sidebar.bottomWidgetRight.lastTab = index
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,9 +172,10 @@ Rectangle {
|
||||
StackLayout {
|
||||
id: tabStack
|
||||
Layout.fillWidth: true
|
||||
height: tabStack.children[0]?.tabLoader?.implicitHeight // TODO: make this less stupid
|
||||
// Take the highest one, because the TODO list has no implicit height. This way the heigth of the calendar is used when it's initially loaded with the TODO list
|
||||
height: Math.max(...tabStack.children.map(child => child.tabLoader?.implicitHeight || 0)) // TODO: make this less stupid
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
property int realIndex: 0
|
||||
property int realIndex: root.selectedTab
|
||||
property int animationDuration: Appearance.animation.elementMoveFast.duration * 1.5
|
||||
|
||||
// Switch the tab on halfway of the anim duration
|
||||
@@ -215,6 +217,10 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
tabStack.currentIndex = root.selectedTab
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user