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 (
|
return (
|
||||||
<FileChooserButton
|
<FileChooserButton
|
||||||
onFileSet={(self) => {
|
onFileSet={(self) => {
|
||||||
const newValue: string = self.get_uri()!.replace('file://', '');
|
const newValue: string = decodeURIComponent(self.get_uri()!.replace('file://', ''));
|
||||||
opt.set(newValue as T);
|
opt.set(newValue as T);
|
||||||
if (options.wallpaper.enable.get()) {
|
if (options.wallpaper.enable.get()) {
|
||||||
Wallpaper.setWallpaper(newValue);
|
Wallpaper.setWallpaper(newValue);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const initializeTrackers = (resetCssFunc: () => void): void => {
|
|||||||
}
|
}
|
||||||
if (options.wallpaper.pywal.get() && dependencies('wal')) {
|
if (options.wallpaper.pywal.get() && dependencies('wal')) {
|
||||||
const wallpaperPath = options.wallpaper.image.get();
|
const wallpaperPath = options.wallpaper.image.get();
|
||||||
bash(`wal -i ${wallpaperPath}`);
|
bash(`wal -i "${wallpaperPath}"`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Wallpaper extends GObject.Object {
|
|||||||
'60',
|
'60',
|
||||||
'--transition-pos',
|
'--transition-pos',
|
||||||
cursorPosition.replace(' ', ''),
|
cursorPosition.replace(' ', ''),
|
||||||
WP,
|
`"${WP}"`,
|
||||||
].join(' ');
|
].join(' ');
|
||||||
|
|
||||||
sh(transitionCmd)
|
sh(transitionCmd)
|
||||||
@@ -50,7 +50,7 @@ class Wallpaper extends GObject.Object {
|
|||||||
this.#blockMonitor = true;
|
this.#blockMonitor = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await sh(`cp ${path} ${WP}`);
|
await sh(`cp "${path}" "${WP}"`);
|
||||||
this.#wallpaper();
|
this.#wallpaper();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error setting wallpaper:', 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 normalizedContrast = contrast.get() > 1 ? 1 : contrast.get() < -1 ? -1 : contrast.get();
|
||||||
const contents = await bash(
|
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()];
|
return JSON.parse(contents).colors[options.theme.matugen_settings.mode.get()];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user