wallpapers: use CAELESTIA_WALLPAPERS_DIR env

Env var overrides config option
This commit is contained in:
2 * r + 2 * t 2025-08-30 22:30:34 +10:00
parent a1ac25c665
commit 9659130fdb
3 changed files with 6 additions and 4 deletions

View file

@ -137,7 +137,7 @@ Item {
} }
StyledText { StyledText {
text: root.state === "wallpapers" && Wallpapers.list.length === 0 ? qsTr("Try putting some wallpapers in %1").arg(Paths.shortenHome(Config.paths.wallpaperDir)) : qsTr("Try searching for something else") text: root.state === "wallpapers" && Wallpapers.list.length === 0 ? qsTr("Try putting some wallpapers in %1").arg(Paths.shortenHome(Paths.wallsdir)) : qsTr("Try searching for something else")
color: Colours.palette.m3onSurfaceVariant color: Colours.palette.m3onSurfaceVariant
font.pointSize: Appearance.font.size.normal font.pointSize: Appearance.font.size.normal
} }

View file

@ -87,7 +87,7 @@ Searcher {
id: getWallsProc id: getWallsProc
running: true running: true
command: ["find", "-L", Paths.expandTilde(Config.paths.wallpaperDir), "-type", "d", "-path", '*/.*', "-prune", "-o", "-not", "-name", '.*', "-type", "f", "-print"] command: ["find", "-L", Paths.expandTilde(Paths.wallsdir), "-type", "d", "-path", '*/.*', "-prune", "-o", "-not", "-name", '.*', "-type", "f", "-print"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: wallpapers.model = text.trim().split("\n").filter(w => Images.isValidImageByName(w)).sort() onStreamFinished: wallpapers.model = text.trim().split("\n").filter(w => Images.isValidImageByName(w)).sort()
} }
@ -97,7 +97,7 @@ Searcher {
id: watchWallsProc id: watchWallsProc
running: true running: true
command: ["inotifywait", "-r", "-e", "close_write,moved_to,create", "-m", Paths.expandTilde(Config.paths.wallpaperDir)] command: ["inotifywait", "-r", "-e", "close_write,moved_to,create", "-m", Paths.expandTilde(Paths.wallsdir)]
stdout: SplitParser { stdout: SplitParser {
onRead: data => { onRead: data => {
if (Images.isValidImageByName(data)) if (Images.isValidImageByName(data))
@ -125,6 +125,6 @@ Searcher {
component Wallpaper: QtObject { component Wallpaper: QtObject {
required property string modelData required property string modelData
readonly property string path: modelData readonly property string path: modelData
readonly property string name: path.slice(Paths.expandTilde(Config.paths.wallpaperDir).length + 1, path.lastIndexOf(".")) readonly property string name: path.slice(Paths.expandTilde(Paths.wallsdir).length + 1, path.lastIndexOf("."))
} }
} }

View file

@ -1,5 +1,6 @@
pragma Singleton pragma Singleton
import qs.config
import Quickshell import Quickshell
import Qt.labs.platform import Qt.labs.platform
@ -15,6 +16,7 @@ Singleton {
readonly property url config: `${StandardPaths.standardLocations(StandardPaths.GenericConfigLocation)[0]}/caelestia` readonly property url config: `${StandardPaths.standardLocations(StandardPaths.GenericConfigLocation)[0]}/caelestia`
readonly property url imagecache: `${cache}/imagecache` readonly property url imagecache: `${cache}/imagecache`
readonly property string wallsdir: Quickshell.env("CAELESTIA_WALLPAPERS_DIR") || Config.paths.wallpaperDir
readonly property string libdir: Quickshell.env("CAELESTIA_LIB_DIR") || "/usr/lib/caelestia" readonly property string libdir: Quickshell.env("CAELESTIA_LIB_DIR") || "/usr/lib/caelestia"
function stringify(path: url): string { function stringify(path: url): string {