wallpaper selector: directory validation, common file browser keybinds

This commit is contained in:
end-4
2025-08-23 22:11:41 +07:00
parent 8e6582b801
commit 80af866650
4 changed files with 106 additions and 77 deletions
+21 -4
View File
@@ -30,15 +30,32 @@ Singleton {
applyProc.exec([Directories.wallpaperSwitchScriptPath])
}
function apply(path) {
function apply(path, darkMode = Appearance.m3colors.darkmode) {
if (!path || path.length === 0) return
applyProc.exec([
"bash", "-c",
`${StringUtils.shellSingleQuoteEscape(Directories.wallpaperSwitchScriptPath)} ` +
`--image ${StringUtils.shellSingleQuoteEscape(path)}`
Directories.wallpaperSwitchScriptPath,
"--image", path,
"--mode", (darkMode ? "dark" : "light")
])
}
Process {
id: validateDirProc
property string nicePath: ""
function setDirectoryIfValid(path) {
validateDirProc.nicePath = FileUtils.trimFileProtocol(path).replace(/\/+$/, "")
validateDirProc.exec(["test", "-d", nicePath])
}
onExited: (exitCode, exitStatus) => {
if (exitCode === 0) {
root.directory = validateDirProc.nicePath
}
}
}
function setDirectory(path) {
validateDirProc.setDirectoryIfValid(path)
}
// Folder model
FolderListModel {
id: files