Fix wallpaper path handling with spaces (#908)
* Fix wallpaper path handling with spaces * fix linting errors --------- Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
@@ -9,7 +9,7 @@ export const WallpaperInputter = <T extends string | number | boolean | object>(
|
||||
return (
|
||||
<FileChooserButton
|
||||
onFileSet={(self) => {
|
||||
const newValue: string = self.get_uri()!.replace('file://', '');
|
||||
const newValue: string = decodeURIComponent(self.get_uri()!.replace('file://', ''));
|
||||
opt.set(newValue as T);
|
||||
if (options.wallpaper.enable.get()) {
|
||||
Wallpaper.setWallpaper(newValue);
|
||||
|
||||
@@ -37,7 +37,7 @@ export const initializeTrackers = (resetCssFunc: () => void): void => {
|
||||
}
|
||||
if (options.wallpaper.pywal.get() && dependencies('wal')) {
|
||||
const wallpaperPath = options.wallpaper.image.get();
|
||||
bash(`wal -i ${wallpaperPath}`);
|
||||
bash(`wal -i "${wallpaperPath}"`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ class Wallpaper extends GObject.Object {
|
||||
'60',
|
||||
'--transition-pos',
|
||||
cursorPosition.replace(' ', ''),
|
||||
WP,
|
||||
`"${WP}"`,
|
||||
].join(' ');
|
||||
|
||||
sh(transitionCmd)
|
||||
@@ -50,7 +50,7 @@ class Wallpaper extends GObject.Object {
|
||||
this.#blockMonitor = true;
|
||||
|
||||
try {
|
||||
await sh(`cp ${path} ${WP}`);
|
||||
await sh(`cp "${path}" "${WP}"`);
|
||||
this.#wallpaper();
|
||||
} catch (error) {
|
||||
console.error('Error setting wallpaper:', error);
|
||||
|
||||
@@ -30,9 +30,11 @@ export async function generateMatugenColors(): Promise<MatugenColors | undefined
|
||||
|
||||
const normalizedContrast = contrast.get() > 1 ? 1 : contrast.get() < -1 ? -1 : contrast.get();
|
||||
const contents = await bash(
|
||||
`matugen image --dry-run -q ${wallpaperPath} -t scheme-${scheme_type.get()} --contrast ${normalizedContrast} --json hex`,
|
||||
`matugen image --dry-run -q "${wallpaperPath}" -t scheme-${scheme_type.get()} --contrast ${normalizedContrast} --json hex`,
|
||||
);
|
||||
await bash(
|
||||
`matugen image -q "${wallpaperPath}" -t scheme-${scheme_type.get()} --contrast ${normalizedContrast}`,
|
||||
);
|
||||
await bash(`matugen image -q ${wallpaperPath} -t scheme-${scheme_type.get()} --contrast ${normalizedContrast}`);
|
||||
|
||||
return JSON.parse(contents).colors[options.theme.matugen_settings.mode.get()];
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user