feat(launcher): restore macOS default wallpaper + external-only apply fix
- electron_relay: add restore_macos_default_wallpaper() — uses run_osascript to find first .heic in /System/Library/Desktop Pictures/ (version-agnostic) - wallpaper cfg: Restore macOS Default button (native or edit_mode); clears applied-URL tracking so next configured URL re-applies correctly - wallpaper cfg: fix Apply Now / Save & Apply enabled when only external URL is filled; display target becomes 'external' to leave built-in unchanged Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -413,6 +413,38 @@ export async function set_wallpaper({
|
||||
return await native.set_wallpaper({ path, url, url_external, display, api_key, account_id });
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the macOS default wallpaper on all displays.
|
||||
* Scans /System/Library/Desktop Pictures/ for the first .heic file — works across
|
||||
* all recent macOS versions without needing to know the version name.
|
||||
* No-op on non-macOS (Linux/Windows return success:false from run_osascript).
|
||||
*/
|
||||
export async function restore_macos_default_wallpaper(
|
||||
display: 'all' | 'primary' | 'external' = 'all'
|
||||
): Promise<{ success: boolean; error?: string }> {
|
||||
const display_target =
|
||||
display === 'primary'
|
||||
? 'tell desktop 1'
|
||||
: display === 'external'
|
||||
? 'tell desktop 2'
|
||||
: 'tell every desktop';
|
||||
|
||||
const script = `
|
||||
set pic_path to do shell script "ls '/System/Library/Desktop Pictures/'*.heic 2>/dev/null | head -1"
|
||||
if pic_path is "" then
|
||||
error "No default macOS wallpaper (.heic) found in /System/Library/Desktop Pictures/"
|
||||
end if
|
||||
tell application "System Events"
|
||||
${display_target}
|
||||
set picture to pic_path
|
||||
end tell
|
||||
end tell
|
||||
`.trim();
|
||||
|
||||
const result = await run_osascript(script);
|
||||
return result ?? { success: false, error: 'Native bridge not available' };
|
||||
}
|
||||
|
||||
export async function update_app(args: {
|
||||
source: 'url' | 'file';
|
||||
url?: string;
|
||||
|
||||
Reference in New Issue
Block a user