summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-07 17:58:18 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-07-07 17:58:18 +1000
commit8a6679eace029338747f0fe95ca683016fce783e (patch)
treecfec1f7045ac457478acf8917a123907ccee5d6c
parentdashboard: fix pfp picker (diff)
downloadcaelestia-shell-8a6679eace029338747f0fe95ca683016fce783e.tar.gz
caelestia-shell-8a6679eace029338747f0fe95ca683016fce783e.tar.bz2
caelestia-shell-8a6679eace029338747f0fe95ca683016fce783e.zip
paths: decode urls
Fixes spaces in paths breaking things
-rw-r--r--config/Config.qml2
-rw-r--r--modules/background/Wallpaper.qml6
-rw-r--r--modules/dashboard/dash/User.qml2
-rw-r--r--modules/lock/Input.qml2
-rw-r--r--services/Colours.qml2
-rw-r--r--utils/Paths.qml10
-rw-r--r--widgets/CachingImage.qml4
7 files changed, 17 insertions, 11 deletions
diff --git a/config/Config.qml b/config/Config.qml
index e655400..843300a 100644
--- a/config/Config.qml
+++ b/config/Config.qml
@@ -19,7 +19,7 @@ Singleton {
property alias paths: adapter.paths
FileView {
- path: `${Paths.config}/shell.json`
+ path: `${Paths.stringify(Paths.config)}/shell.json`
watchChanges: true
onFileChanged: reload()
onAdapterUpdated: writeAdapter()
diff --git a/modules/background/Wallpaper.qml b/modules/background/Wallpaper.qml
index 7238303..ef25885 100644
--- a/modules/background/Wallpaper.qml
+++ b/modules/background/Wallpaper.qml
@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
import "root:/widgets"
import "root:/services"
import "root:/config"
+import "root:/utils"
import QtQuick
import QtQuick.Dialogs
@@ -63,9 +64,10 @@ Item {
FileDialog {
id: dialog
+ title: qsTr("Select a wallpaper")
+ acceptLabel: qsTr("Select")
nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`]
-
- onAccepted: Wallpapers.setWallpaper(selectedFile.toString().replace("file://", ""))
+ onAccepted: Wallpapers.setWallpaper(Paths.strip(selectedFile))
}
StateLayer {
diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml
index baf9efb..403885f 100644
--- a/modules/dashboard/dash/User.qml
+++ b/modules/dashboard/dash/User.qml
@@ -36,7 +36,7 @@ Row {
id: pfp
anchors.fill: parent
- path: `${Paths.home}/.face`
+ path: `${Paths.stringify(Paths.home)}/.face`
}
MouseArea {
diff --git a/modules/lock/Input.qml b/modules/lock/Input.qml
index f5b3c16..cb2146a 100644
--- a/modules/lock/Input.qml
+++ b/modules/lock/Input.qml
@@ -43,7 +43,7 @@ ColumnLayout {
CachingImage {
anchors.fill: parent
- path: `${Paths.home}/.face`
+ path: `${Paths.stringify(Paths.home)}/.face`
}
}
diff --git a/services/Colours.qml b/services/Colours.qml
index 3a26e84..9492c8b 100644
--- a/services/Colours.qml
+++ b/services/Colours.qml
@@ -58,7 +58,7 @@ Singleton {
}
FileView {
- path: `${Paths.state}/scheme.json`
+ path: `${Paths.stringify(Paths.state)}/scheme.json`
watchChanges: true
onFileChanged: reload()
onLoaded: root.load(text(), false)
diff --git a/utils/Paths.qml b/utils/Paths.qml
index ac95e80..0e3ac3b 100644
--- a/utils/Paths.qml
+++ b/utils/Paths.qml
@@ -16,16 +16,20 @@ Singleton {
readonly property url imagecache: `${cache}/imagecache`
+ function stringify(path: url): string {
+ return path.toString().replace(/%20/g, " ");
+ }
+
function expandTilde(path: string): string {
- return strip(path.replace("~", root.home.toString()));
+ return strip(path.replace("~", stringify(root.home)));
}
function shortenHome(path: string): string {
- return path.replace(strip(root.home.toString()), "~");
+ return path.replace(strip(root.home), "~");
}
function strip(path: url): string {
- return path.toString().replace("file://", "");
+ return stringify(path).replace("file://", "");
}
function mkdir(path: url): void {
diff --git a/widgets/CachingImage.qml b/widgets/CachingImage.qml
index a786720..f27ecbd 100644
--- a/widgets/CachingImage.qml
+++ b/widgets/CachingImage.qml
@@ -8,7 +8,7 @@ Image {
property string path
property string hash
- readonly property string cachePath: `${Paths.imagecache}/${hash}@${width}x${height}.png`.slice(7)
+ readonly property string cachePath: `${Paths.stringify(Paths.imagecache)}/${hash}@${width}x${height}.png`.slice(7)
asynchronous: true
cache: false
@@ -16,7 +16,7 @@ Image {
sourceSize.width: width
sourceSize.height: height
- onPathChanged: shaProc.exec(["sha256sum", path.replace("file://", "")])
+ onPathChanged: shaProc.exec(["sha256sum", Paths.strip(path)])
onCachePathChanged: {
if (hash)