Adjust Linux wallpaper test mode
This commit is contained in:
45
dist/main/system_handlers.js
vendored
45
dist/main/system_handlers.js
vendored
@@ -221,18 +221,41 @@ function registerSystemHandlers() {
|
||||
}
|
||||
}
|
||||
if (os.platform() === 'linux') {
|
||||
let img_path = imagePath ? (0, file_utils_1.expandPath)(imagePath) : null;
|
||||
if (!img_path && url) {
|
||||
const result = await download_wallpaper_image(url, 'wallpaper_primary');
|
||||
if (!result.success || !result.path)
|
||||
return { success: false, error: result.error };
|
||||
img_path = result.path;
|
||||
}
|
||||
if (!img_path)
|
||||
// Dev test mode: never touch the desktop on Linux. Running gsettings during
|
||||
// development would reset the dev workstation monitors on every test cycle.
|
||||
// Return what would have run so the Svelte side can show a debug popup.
|
||||
const would_run = [];
|
||||
const cache_dir = wallpaper_cache_dir;
|
||||
if (!imagePath && !url && !url_external) {
|
||||
return { success: false, error: 'No image source provided' };
|
||||
if (!fs.existsSync(img_path))
|
||||
return { success: false, error: 'Image file not found' };
|
||||
return await runExec(`gsettings set org.gnome.desktop.background picture-uri "file://${img_path}"`);
|
||||
}
|
||||
if (imagePath) {
|
||||
const clean = (0, file_utils_1.expandPath)(imagePath);
|
||||
if (!fs.existsSync(clean))
|
||||
return { success: false, error: 'Image file not found' };
|
||||
}
|
||||
if (url)
|
||||
would_run.push(`download: ${url}\n → ${path.join(cache_dir, 'wallpaper_primary.jpg')}`);
|
||||
if (url_external)
|
||||
would_run.push(`download: ${url_external}\n → ${path.join(cache_dir, 'wallpaper_external.jpg')}`);
|
||||
if (imagePath) {
|
||||
would_run.push(`gsettings set org.gnome.desktop.background picture-uri "file://${(0, file_utils_1.expandPath)(imagePath)}"`);
|
||||
}
|
||||
else if (url) {
|
||||
would_run.push(`gsettings set org.gnome.desktop.background picture-uri "file://${path.join(cache_dir, 'wallpaper_primary.jpg')}"`);
|
||||
}
|
||||
if (url_external) {
|
||||
would_run.push(`(external display: gsettings has no per-display wallpaper support)`);
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
linux_test_mode: true,
|
||||
platform: 'linux',
|
||||
display,
|
||||
url: url ?? null,
|
||||
url_external: url_external ?? null,
|
||||
would_run
|
||||
};
|
||||
}
|
||||
return { success: false, error: 'Platform not supported' };
|
||||
});
|
||||
|
||||
2
dist/main/system_handlers.js.map
vendored
2
dist/main/system_handlers.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user