forked from Shinonome/dots-hyprland
Right sidebar: restore last viewed bottom widget (#1622)
This commit is contained in:
@@ -36,6 +36,7 @@ Singleton {
|
|||||||
property JsonObject sidebar: JsonObject {
|
property JsonObject sidebar: JsonObject {
|
||||||
property JsonObject bottomGroup: JsonObject {
|
property JsonObject bottomGroup: JsonObject {
|
||||||
property bool collapsed: false
|
property bool collapsed: false
|
||||||
|
property int tab: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Singleton {
|
|||||||
property QtObject sidebar: QtObject {
|
property QtObject sidebar: QtObject {
|
||||||
property QtObject bottomGroup: QtObject {
|
property QtObject bottomGroup: QtObject {
|
||||||
property bool collapsed: false
|
property bool collapsed: false
|
||||||
|
property int tab: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Rectangle {
|
|||||||
color: Appearance.colors.colLayer1
|
color: Appearance.colors.colLayer1
|
||||||
clip: true
|
clip: true
|
||||||
implicitHeight: collapsed ? collapsedBottomWidgetGroupRow.implicitHeight : bottomWidgetGroupRow.implicitHeight
|
implicitHeight: collapsed ? collapsedBottomWidgetGroupRow.implicitHeight : bottomWidgetGroupRow.implicitHeight
|
||||||
property int selectedTab: 0
|
property int selectedTab: Persistent.states.sidebar.bottomGroup.tab
|
||||||
property bool collapsed: Persistent.states.sidebar.bottomGroup.collapsed
|
property bool collapsed: Persistent.states.sidebar.bottomGroup.collapsed
|
||||||
property var tabs: [
|
property var tabs: [
|
||||||
{"type": "calendar", "name": Translation.tr("Calendar"), "icon": "calendar_month", "widget": calendarWidget},
|
{"type": "calendar", "name": Translation.tr("Calendar"), "icon": "calendar_month", "widget": calendarWidget},
|
||||||
@@ -146,6 +146,7 @@ Rectangle {
|
|||||||
buttonIcon: modelData.icon
|
buttonIcon: modelData.icon
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.selectedTab = index
|
root.selectedTab = index
|
||||||
|
Persistent.states.sidebar.bottomGroup.tab = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,10 +172,12 @@ Rectangle {
|
|||||||
StackLayout {
|
StackLayout {
|
||||||
id: tabStack
|
id: tabStack
|
||||||
Layout.fillWidth: true
|
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
|
Layout.alignment: Qt.AlignVCenter
|
||||||
property int realIndex: 0
|
property int realIndex: root.selectedTab
|
||||||
property int animationDuration: Appearance.animation.elementMoveFast.duration * 1.5
|
property int animationDuration: Appearance.animation.elementMoveFast.duration * 1.5
|
||||||
|
currentIndex: root.selectedTab
|
||||||
|
|
||||||
// Switch the tab on halfway of the anim duration
|
// Switch the tab on halfway of the anim duration
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
Reference in New Issue
Block a user