diff --git a/electron/main.js b/electron/main.js index 101ed172..1303894e 100644 --- a/electron/main.js +++ b/electron/main.js @@ -3114,59 +3114,6 @@ ipcMain.handle('open-application', (_event, name) => { return true; }); -// The user's REAL desktop wallpaper for the dashboard background, read at runtime and never -// bundled (Apple's images can't ship in an open-source repo). Any failure on any platform -// returns null and the renderer keeps its SVG scenery, so this can only ever add. -let desktopWallpaperCache; -ipcMain.handle('get-desktop-wallpaper', async () => { - if (desktopWallpaperCache !== undefined) return desktopWallpaperCache; - const { execFile } = require('child_process'); - const run = (cmd, args) => new Promise((resolve, reject) => { - execFile(cmd, args, { timeout: 8000 }, (err, stdout) => (err ? reject(err) : resolve(String(stdout).trim()))); - }); - try { - if (process.platform === 'darwin') { - let srcPath = await run('/usr/bin/osascript', ['-e', 'tell application "System Events" to get picture of current desktop']).catch(() => ''); - if (!srcPath || !fs.existsSync(srcPath)) { - // Dynamic/aerial wallpapers report a reaped temp frame; the wallpaper store may still hold a real image path. - srcPath = ''; - try { - const storePath = path.join(app.getPath('home'), 'Library', 'Application Support', 'com.apple.wallpaper', 'Store', 'Index.plist'); - const raw = fs.readFileSync(storePath, 'latin1'); - const candidates = [...raw.matchAll(/file:\/\/(\/[ -~]+?\.(?:jpg|jpeg|png|heic|tiff))/gi)].map((m) => decodeURIComponent(m[1])); - srcPath = candidates.find((c) => fs.existsSync(c)) || ''; - } catch (_) { /* fall through to the SVG scenery */ } - } - if (!srcPath) { desktopWallpaperCache = null; return null; } - // sips normalizes HEIC sources to jpeg and downscales so the data URL stays small. - const outPath = path.join(app.getPath('userData'), 'wallpaper-cache.jpg'); - await run('/usr/bin/sips', ['-s', 'format', 'jpeg', '--resampleHeightWidthMax', '2400', srcPath, '--out', outPath]); - desktopWallpaperCache = `data:image/jpeg;base64,${fs.readFileSync(outPath).toString('base64')}`; - return desktopWallpaperCache; - } - if (process.platform === 'win32') { - // Windows keeps the active wallpaper pre-transcoded as a JPEG; the registry path is the fallback. - const transcoded = path.join(app.getPath('appData'), 'Microsoft', 'Windows', 'Themes', 'TranscodedWallpaper'); - let srcPath = fs.existsSync(transcoded) ? transcoded : null; - if (!srcPath) { - const out = await run('reg', ['query', 'HKCU\\Control Panel\\Desktop', '/v', 'WallPaper']); - const match = out.match(/WallPaper\s+REG_SZ\s+(.+)$/m); - if (match && fs.existsSync(match[1].trim())) srcPath = match[1].trim(); - } - if (!srcPath) { desktopWallpaperCache = null; return null; } - const ext = path.extname(srcPath).toLowerCase(); - const mime = ext === '.png' ? 'image/png' : ext === '.bmp' ? 'image/bmp' : 'image/jpeg'; - desktopWallpaperCache = `data:${mime};base64,${fs.readFileSync(srcPath).toString('base64')}`; - return desktopWallpaperCache; - } - desktopWallpaperCache = null; - return null; - } catch (_) { - desktopWallpaperCache = null; - return null; - } -}); - // Affiliate install state. Returns the persisted install.json contents so // the renderer can attach the referral code to authenticated cloud calls // (Stripe checkout, sign-in events) for downstream attribution. diff --git a/electron/preload.js b/electron/preload.js index 26c736dc..b34f065a 100644 --- a/electron/preload.js +++ b/electron/preload.js @@ -77,7 +77,6 @@ contextBridge.exposeInMainWorld('openswarm', { capturePage: (rect) => ipcRenderer.invoke('capture-page', rect), getAppIcon: (name) => ipcRenderer.invoke('get-app-icon', name), openApplication: (name) => ipcRenderer.invoke('open-application', name), - getDesktopWallpaper: () => ipcRenderer.invoke('get-desktop-wallpaper'), getUpdateStatus: () => ipcRenderer.invoke('get-update-status'), getCrashRecoveryInfo: () => ipcRenderer.invoke('get-crash-recovery-info'), checkForUpdates: () => ipcRenderer.invoke('check-for-updates'), diff --git a/frontend/src/app/pages/Dashboard/canvas/DashboardCanvas.tsx b/frontend/src/app/pages/Dashboard/canvas/DashboardCanvas.tsx index 044a4e40..d71edb65 100644 --- a/frontend/src/app/pages/Dashboard/canvas/DashboardCanvas.tsx +++ b/frontend/src/app/pages/Dashboard/canvas/DashboardCanvas.tsx @@ -7,7 +7,7 @@ import TetherLayer from './TetherLayer'; import DashboardCardLayer from './DashboardCardLayer'; import DashboardOverlays from './DashboardOverlays'; import DashboardEmptyState from './DashboardEmptyState'; -import DesktopWallpaper from '../desktop/DesktopWallpaper'; +import '../desktop/desktop.css'; import DesktopDock from '../desktop/DesktopDock'; import MinimizedStack from '../desktop/MinimizedStack'; import ApplicationsWindow from '../desktop/ApplicationsWindow'; @@ -291,8 +291,6 @@ const DashboardCanvas: React.FC = ({ : 'default', }} > - - {/* Gradient wash: the user's theme-pad stops tint the canvas, Arc-window style; intensity + grain come from the theme device; sits under the dot grid. */} {gradient && gradient.length > 1 && ( deep indigo so glass chrome always has contrast), depth via aerial - * perspective (far ridges blurred + desaturated, near ridges sharp with a lit crest), and life via - * ONE imperceptible compositor-only drift (120s, transform-only, off under reduced-motion). - */ -function DesktopWallpaper(): React.ReactElement { - const { mode } = useThemeMode(); - // The user's real OS wallpaper when the Electron bridge can supply it (never bundled); SVG scenery otherwise. - const [realWallpaper, setRealWallpaper] = useState(null); - useEffect(() => { - const getWallpaper = (window as unknown as { openswarm?: { getDesktopWallpaper?: () => Promise } }) - .openswarm?.getDesktopWallpaper; - if (!getWallpaper) return; - let cancelled = false; - getWallpaper().then((dataUrl) => { if (!cancelled && dataUrl) setRealWallpaper(dataUrl); }).catch(() => undefined); - return () => { cancelled = true; }; - }, []); - - if (realWallpaper) { - return ( - - - {mode === 'dark' && } - - ); - } - - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {/* Far layer: soft pink billow owning the right half + red-magenta ridge from the top-left. Blurred + gentle = aerial distance. */} - - - - - - {/* Mid layer: the magenta band bridging the composition. */} - - - - - {/* Deep purple shoulder anchoring the bottom-left. */} - - - - - {/* Near layer: violet crest + indigo foreground wave, sharpest, with lit crests. */} - - - - - - - - {mode === 'dark' && ( - - )} - - ); -} - -export default DesktopWallpaper;