diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-07 14:20:10 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-07-07 14:20:10 +1000 |
| commit | 3221ca18583c18e9852c25476adaf2f1f9b7dabc (patch) | |
| tree | 2e145f088415a6aefc12b157b216c670cab2b357 /modules/dashboard | |
| parent | issues: better templates (diff) | |
| download | caelestia-shell-3221ca18583c18e9852c25476adaf2f1f9b7dabc.tar.gz caelestia-shell-3221ca18583c18e9852c25476adaf2f1f9b7dabc.tar.bz2 caelestia-shell-3221ca18583c18e9852c25476adaf2f1f9b7dabc.zip | |
dashboard: fix pfp picker
Fixes caelestia-dots/caelestia#21
Diffstat (limited to 'modules/dashboard')
| -rw-r--r-- | modules/dashboard/Content.qml | 1 | ||||
| -rw-r--r-- | modules/dashboard/Dash.qml | 5 | ||||
| -rw-r--r-- | modules/dashboard/Wrapper.qml | 17 | ||||
| -rw-r--r-- | modules/dashboard/dash/User.qml | 15 |
4 files changed, 22 insertions, 16 deletions
diff --git a/modules/dashboard/Content.qml b/modules/dashboard/Content.qml index 4f4e242..16d3ac0 100644 --- a/modules/dashboard/Content.qml +++ b/modules/dashboard/Content.qml @@ -87,6 +87,7 @@ Item { Pane { sourceComponent: Dash { visibilities: root.visibilities + state: root.state } } diff --git a/modules/dashboard/Dash.qml b/modules/dashboard/Dash.qml index 56312ba..2be30f7 100644 --- a/modules/dashboard/Dash.qml +++ b/modules/dashboard/Dash.qml @@ -2,12 +2,14 @@ import "root:/widgets" import "root:/services" import "root:/config" import "dash" +import Quickshell import QtQuick.Layouts GridLayout { id: root - required property var visibilities + required property PersistentProperties visibilities + required property PersistentProperties state rowSpacing: Appearance.spacing.normal columnSpacing: Appearance.spacing.normal @@ -22,6 +24,7 @@ GridLayout { id: user visibilities: root.visibilities + state: root.state } } diff --git a/modules/dashboard/Wrapper.qml b/modules/dashboard/Wrapper.qml index 26f6d5b..8b16d5b 100644 --- a/modules/dashboard/Wrapper.qml +++ b/modules/dashboard/Wrapper.qml @@ -1,8 +1,11 @@ pragma ComponentBehavior: Bound -import QtQuick -import Quickshell +import "root:/services" import "root:/config" +import "root:/utils" +import Quickshell +import QtQuick +import QtQuick.Dialogs Item { id: root @@ -10,6 +13,16 @@ Item { required property PersistentProperties visibilities readonly property PersistentProperties state: PersistentProperties { property int currentTab + + readonly property FileDialog facePicker: FileDialog { + title: qsTr("Select a profile picture") + acceptLabel: qsTr("Select") + nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`] + onAccepted: { + Paths.copy(selectedFile, `${Paths.home}/.face`); + Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "low", "-h", `STRING:image-path:${Paths.strip(selectedFile)}`, "Profile picture changed", `Profile picture changed to ${Paths.shortenHome(Paths.strip(selectedFile))}`]); + } + } } visible: height > 0 diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml index ba4fa18..baf9efb 100644 --- a/modules/dashboard/dash/User.qml +++ b/modules/dashboard/dash/User.qml @@ -11,6 +11,7 @@ Row { id: root required property PersistentProperties visibilities + required property PersistentProperties state padding: Appearance.padding.large spacing: Appearance.spacing.normal @@ -46,7 +47,7 @@ Row { onClicked: { root.visibilities.launcher = false; - dialog.open(); + root.state.facePicker.open(); } StyledRect { @@ -103,18 +104,6 @@ Row { } } } - - FileDialog { - id: dialog - - nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`] - - onAccepted: { - Paths.copy(selectedFile, `${Paths.home}/.face`); - pfp.pathChanged(); - Quickshell.execDetached(["notify-send", "-a", "caelestia-shell", "-u", "low", "Profile picture changed", `Profile picture changed to ${Paths.strip(selectedFile)}`]); - } - } } Column { |