summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-24 16:31:23 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-24 16:31:23 +0800
commita0cc31ff581fb33c679b2016d2d00d4d86cb7031 (patch)
tree365854d14605e569e32228b1a2a6d6225c4e38bd
parenticons: better matching + add category icon (diff)
downloadcaelestia-shell-a0cc31ff581fb33c679b2016d2d00d4d86cb7031.tar.gz
caelestia-shell-a0cc31ff581fb33c679b2016d2d00d4d86cb7031.tar.bz2
caelestia-shell-a0cc31ff581fb33c679b2016d2d00d4d86cb7031.zip
refactor: path utils
-rw-r--r--config/Appearance.qml2
-rw-r--r--modules/dashboard/dash/User.qml3
-rw-r--r--services/Colours.qml6
-rw-r--r--services/Thumbnailer.qml4
-rw-r--r--services/Wallpapers.qml6
-rw-r--r--utils/Paths.qml15
6 files changed, 24 insertions, 12 deletions
diff --git a/config/Appearance.qml b/config/Appearance.qml
index 24f98cf..633f273 100644
--- a/config/Appearance.qml
+++ b/config/Appearance.qml
@@ -1,9 +1,7 @@
pragma Singleton
import Quickshell
-import Quickshell.Io
import QtQuick
-import Qt.labs.platform
Singleton {
id: root
diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml
index 700216f..a36536f 100644
--- a/modules/dashboard/dash/User.qml
+++ b/modules/dashboard/dash/User.qml
@@ -6,7 +6,6 @@ import Quickshell
import Quickshell.Io
import Quickshell.Widgets
import QtQuick
-import Qt.labs.platform
Row {
id: root
@@ -31,7 +30,7 @@ Row {
CachingImage {
anchors.fill: parent
- path: `${StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]}/.face`
+ path: `${Paths.home}/.face`
}
Behavior on color {
diff --git a/services/Colours.qml b/services/Colours.qml
index 07e2345..8b6ce00 100644
--- a/services/Colours.qml
+++ b/services/Colours.qml
@@ -1,10 +1,10 @@
pragma Singleton
import "root:/config"
+import "root:/utils"
import Quickshell
import Quickshell.Io
import QtQuick
-import Qt.labs.platform
Singleton {
id: root
@@ -54,14 +54,14 @@ Singleton {
}
FileView {
- path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current-mode.txt`
+ path: `${Paths.state}/scheme/current-mode.txt`
watchChanges: true
onFileChanged: reload()
onLoaded: root.light = text() === "light"
}
FileView {
- path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current.txt`
+ path: `${Paths.state}/scheme/current.txt`
watchChanges: true
onFileChanged: reload()
onLoaded: root.load(text(), false)
diff --git a/services/Thumbnailer.qml b/services/Thumbnailer.qml
index 3d7a6c1..6a6066c 100644
--- a/services/Thumbnailer.qml
+++ b/services/Thumbnailer.qml
@@ -1,15 +1,15 @@
pragma Singleton
pragma ComponentBehavior: Bound
+import "root:/utils"
import Quickshell
import Quickshell.Io
import QtQuick
-import Qt.labs.platform
Singleton {
id: root
- readonly property string thumbDir: `${StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]}/caelestia/thumbnails`.slice(7)
+ readonly property string thumbDir: `${Paths.cache}/thumbnails`.slice(7)
function go(obj: var): var {
return thumbComp.createObject(obj, {
diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml
index 4bfa72f..1de5227 100644
--- a/services/Wallpapers.qml
+++ b/services/Wallpapers.qml
@@ -1,16 +1,16 @@
pragma Singleton
import "root:/utils/scripts/fuzzysort.js" as Fuzzy
+import "root:/utils"
import Quickshell
import Quickshell.Io
import QtQuick
-import Qt.labs.platform
Singleton {
id: root
- readonly property string currentNamePath: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/wallpaper/last.txt`.slice(7)
- readonly property string path: `${StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]}/Wallpapers`.slice(7)
+ readonly property string currentNamePath: `${Paths.state}/wallpaper/last.txt`.slice(7)
+ readonly property string path: `${Paths.pictures}/Wallpapers`.slice(7)
readonly property list<Wallpaper> list: wallpapers.instances
property bool showPreview: false
diff --git a/utils/Paths.qml b/utils/Paths.qml
new file mode 100644
index 0000000..011bb1f
--- /dev/null
+++ b/utils/Paths.qml
@@ -0,0 +1,15 @@
+pragma Singleton
+
+import Quickshell
+import Qt.labs.platform
+
+Singleton {
+ id: root
+
+ readonly property url home: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
+ readonly property url pictures: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
+
+ readonly property url data: `${StandardPaths.standardLocations(StandardPaths.GenericDataLocation)[0]}/caelestia`
+ readonly property url state: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia`
+ readonly property url cache: `${StandardPaths.standardLocations(StandardPaths.GenericCacheLocation)[0]}/caelestia`
+}