diff --git a/packages/desktop/src/renderer/default-background.avif b/packages/desktop/src/renderer/default-background.avif new file mode 100644 index 0000000000..2fb277d048 Binary files /dev/null and b/packages/desktop/src/renderer/default-background.avif differ diff --git a/packages/desktop/src/renderer/index.tsx b/packages/desktop/src/renderer/index.tsx index 55f164d8e8..b899c7e6e4 100644 --- a/packages/desktop/src/renderer/index.tsx +++ b/packages/desktop/src/renderer/index.tsx @@ -21,6 +21,7 @@ import { createMemoryHistory, MemoryRouter, type BaseRouterProps } from "@solidj import { createEffect, createMemo, createResource, createSignal, onCleanup, onMount, Show } from "solid-js" import { render } from "solid-js/web" import pkg from "../../package.json" +import defaultBackground from "./default-background.avif" import { initI18n, t } from "./i18n" import { initializationData, initializationReady } from "./initialization" import { DesktopFirstLaunchOnboarding } from "./onboarding" @@ -112,10 +113,11 @@ function DesktopMemoryRouter(props: BaseRouterProps & { windowID: string }) { const createPlatform = (windowState: DesktopWindowState): Platform => { const attachmentPaths = new WeakMap() - const [backgroundImage, setBackgroundImage] = createSignal(false) + const [backgroundImage, setBackgroundImage] = createSignal(true) const applyBackgroundImage = (image: Awaited>) => { - setBackgroundImage(!!image) - document.documentElement.toggleAttribute("data-background-image", !!image) + const active = !!image || localStorage.getItem("background-image.default.dismissed") !== "true" + setBackgroundImage(active) + document.documentElement.toggleAttribute("data-background-image", active) if (image) { document.documentElement.style.setProperty( "--app-background-image", @@ -123,6 +125,10 @@ const createPlatform = (windowState: DesktopWindowState): Platform => { ) return true } + if (active) { + document.documentElement.style.setProperty("--app-background-image", `url("${defaultBackground}")`) + return true + } document.documentElement.style.removeProperty("--app-background-image") return false } @@ -333,11 +339,13 @@ const createPlatform = (windowState: DesktopWindowState): Platform => { async selectBackgroundImage() { const image = await window.api.selectBackgroundImage() if (!image) return backgroundImage() + localStorage.removeItem("background-image.default.dismissed") return applyBackgroundImage(image) }, async clearBackgroundImage() { await window.api.clearBackgroundImage() + localStorage.setItem("background-image.default.dismissed", "true") applyBackgroundImage(null) },