feat(launcher): skip wallpaper gsettings on Linux, show dev popup instead
Running gsettings on the dev workstation resets monitors on every test cycle. Linux Electron handler now returns linux_test_mode:true with would_run details instead of applying. Svelte cfg component shows a debug popup (mirrors Native Test Mode style). Background sync logs to console and leaves applied-URL unset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,9 @@ let apply_status = $state('');
|
||||
let restore_status = $state('');
|
||||
let last_device_id: string | null = null;
|
||||
|
||||
let linux_test_popup_open = $state(false);
|
||||
let linux_test_popup_data = $state<Record<string, unknown> | null>(null);
|
||||
|
||||
function get_native_device(): NativeDeviceLike | null {
|
||||
const store_loc = $ae_loc as { native_device?: NativeDeviceLike };
|
||||
return store_loc.native_device ?? null;
|
||||
@@ -140,7 +143,11 @@ async function handle_apply() {
|
||||
account_id: String($ae_api.account_id ?? '')
|
||||
});
|
||||
|
||||
if (result?.success) {
|
||||
if (result?.success && (result as any).linux_test_mode) {
|
||||
linux_test_popup_data = result as Record<string, unknown>;
|
||||
linux_test_popup_open = true;
|
||||
set_apply_status('Linux dev mode — see popup');
|
||||
} else if (result?.success) {
|
||||
$events_loc.launcher.wallpaper_applied_url = url || null;
|
||||
$events_loc.launcher.wallpaper_applied_url_external = url_ext || null;
|
||||
set_apply_status('Applied ✓');
|
||||
@@ -328,3 +335,76 @@ const section_description = $derived(
|
||||
{/if}
|
||||
</div>
|
||||
</Launcher_Cfg_Section>
|
||||
|
||||
<!-- Linux Dev Mode Popup — mirrors Native Test Mode style -->
|
||||
<!-- Shows what WOULD have been applied; actual gsettings call is skipped to avoid
|
||||
resetting the dev workstation monitors on every test cycle. -->
|
||||
{#if linux_test_popup_open && linux_test_popup_data}
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="fixed inset-0 z-9999 flex items-center justify-center bg-black/70 p-4"
|
||||
role="presentation"
|
||||
onclick={() => (linux_test_popup_open = false)}>
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="bg-surface-50/95 dark:bg-surface-900/95 border-warning-500/40 relative flex max-h-[90vh] w-full max-w-lg flex-col gap-0 overflow-hidden rounded-xl border shadow-2xl"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="Linux Dev Mode — Wallpaper not applied"
|
||||
tabindex="-1"
|
||||
onclick={(e) => e.stopPropagation()}>
|
||||
|
||||
<div class="bg-warning-500/10 border-warning-500/30 flex items-center gap-2 border-b px-4 py-3">
|
||||
<span class="text-warning-600 dark:text-warning-400 font-mono text-xs font-bold uppercase tracking-wider">
|
||||
🧪 Linux Dev Mode — Wallpaper not applied
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => (linux_test_popup_open = false)}
|
||||
class="btn btn-xs preset-tonal-surface ml-auto">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-3 overflow-y-auto p-4 font-mono text-xs">
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-[9px] font-bold uppercase opacity-50">Display Target</span>
|
||||
<div class="rounded bg-surface-500/10 px-3 py-2">
|
||||
{linux_test_popup_data.display ?? 'all'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if linux_test_popup_data.url}
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-[9px] font-bold uppercase opacity-50">Primary URL</span>
|
||||
<div class="text-primary-500 rounded bg-surface-500/10 px-3 py-2 break-all">
|
||||
{linux_test_popup_data.url}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if linux_test_popup_data.url_external}
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-[9px] font-bold uppercase opacity-50">External / Projector URL</span>
|
||||
<div class="text-primary-500 rounded bg-surface-500/10 px-3 py-2 break-all">
|
||||
{linux_test_popup_data.url_external}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="text-[9px] font-bold uppercase opacity-50">Would Have Run</span>
|
||||
<div class="rounded bg-surface-500/10 px-3 py-2 leading-relaxed whitespace-pre-wrap text-success-600 dark:text-success-400">
|
||||
{#each (linux_test_popup_data.would_run as string[]) as cmd}
|
||||
<div class="mb-1">{cmd}</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="text-[9px] italic opacity-40">
|
||||
gsettings is skipped on Linux to avoid resetting dev monitors. On macOS this applies via osascript.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -71,7 +71,11 @@ async function apply_wallpaper_if_changed(device_other_json: unknown) {
|
||||
account_id: String($ae_api.account_id ?? '')
|
||||
});
|
||||
|
||||
if (result?.success) {
|
||||
if (result?.success && (result as any).linux_test_mode) {
|
||||
// Linux dev mode: gsettings was skipped. Log and leave applied URL unset so
|
||||
// the cfg component popup can show the details when triggered manually.
|
||||
console.info('Sync: Wallpaper linux_test_mode — would have applied:', (result as any).would_run);
|
||||
} else if (result?.success) {
|
||||
$events_loc.launcher.wallpaper_applied_url = configured_url || null;
|
||||
$events_loc.launcher.wallpaper_applied_url_external = configured_url_external || null;
|
||||
if (log_lvl) console.log('Sync: Wallpaper applied.');
|
||||
|
||||
Reference in New Issue
Block a user