summaryrefslogtreecommitdiff
path: root/modules/dashboard/Wrapper.qml
diff options
context:
space:
mode:
Diffstat (limited to 'modules/dashboard/Wrapper.qml')
-rw-r--r--modules/dashboard/Wrapper.qml49
1 files changed, 35 insertions, 14 deletions
diff --git a/modules/dashboard/Wrapper.qml b/modules/dashboard/Wrapper.qml
index 95c57b8..2dcd5c9 100644
--- a/modules/dashboard/Wrapper.qml
+++ b/modules/dashboard/Wrapper.qml
@@ -13,20 +13,21 @@ Item {
id: root
required property PersistentProperties visibilities
- readonly property PersistentProperties state: PersistentProperties {
+ readonly property PersistentProperties dashState: PersistentProperties {
property int currentTab
property date currentDate: new Date()
- readonly property FileDialog facePicker: FileDialog {
- title: qsTr("Select a profile picture")
- filterLabel: qsTr("Image files")
- filters: Images.validImageExtensions
- onAccepted: path => {
- if (CUtils.copyFile(Qt.resolvedUrl(path), Qt.resolvedUrl(`${Paths.home}/.face`)))
- Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "low", "-h", `STRING:image-path:${path}`, "Profile picture changed", `Profile picture changed to ${Paths.shortenHome(path)}`]);
- else
- Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "critical", "Unable to change profile picture", `Failed to change profile picture to ${Paths.shortenHome(path)}`]);
- }
+ reloadableId: "dashboardState"
+ }
+ readonly property FileDialog facePicker: FileDialog {
+ title: qsTr("Select a profile picture")
+ filterLabel: qsTr("Image files")
+ filters: Images.validImageExtensions
+ onAccepted: path => {
+ if (CUtils.copyFile(Qt.resolvedUrl(path), Qt.resolvedUrl(`${Paths.home}/.face`)))
+ Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "low", "-h", `STRING:image-path:${path}`, "Profile picture changed", `Profile picture changed to ${Paths.shortenHome(path)}`]);
+ else
+ Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "critical", "Unable to change profile picture", `Failed to change profile picture to ${Paths.shortenHome(path)}`]);
}
}
@@ -34,6 +35,13 @@ Item {
implicitHeight: 0
implicitWidth: content.implicitWidth
+ onStateChanged: {
+ if (state === "visible" && timer.running) {
+ timer.triggered();
+ timer.stop();
+ }
+ }
+
states: State {
name: "visible"
when: root.visibilities.dashboard && Config.dashboard.enabled
@@ -73,17 +81,30 @@ Item {
onCleared: root.visibilities.dashboard = false
}
+ Timer {
+ id: timer
+
+ running: true
+ interval: Appearance.anim.durations.extraLarge
+ onTriggered: {
+ content.active = Qt.binding(() => (root.visibilities.dashboard && Config.dashboard.enabled) || root.visible);
+ content.visible = true;
+ }
+ }
+
Loader {
id: content
- Component.onCompleted: active = Qt.binding(() => (root.visibilities.dashboard && Config.dashboard.enabled) || root.visible)
-
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
+ visible: false
+ active: true
+
sourceComponent: Content {
visibilities: root.visibilities
- state: root.state
+ state: root.dashState
+ facePicker: root.facePicker
}
}
}