From 823b6dca094b1437a695d2ec23d4a5fa1bf44426 Mon Sep 17 00:00:00 2001 From: Angel Wang Date: Fri, 26 Jun 2026 19:17:52 -0600 Subject: [PATCH] feat(apply): macOS wallpaper --- src/apply/index.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/apply/index.ts b/src/apply/index.ts index 1913413..dee82b1 100644 --- a/src/apply/index.ts +++ b/src/apply/index.ts @@ -110,9 +110,8 @@ matchingImages.forEach((image) => console.info(`Setting wallpaper...`) -if (Deno.build.os != "windows") { - await $`eval ${config.applyWallpaperCommand.replace("%s", matchingImages[0].path)}` -} else { + +if (Deno.build.os == "windows") { const command = ` $setwallpapersrc = @" using System.Runtime.InteropServices; @@ -136,6 +135,11 @@ Add-Type -TypeDefinition $setwallpapersrc usePowerShell() // await $`Write-Host ${command}` await $`${command} | iex` +} else if (Deno.build.os == "darwin") { + const command = `tell application "System Events" to set picture of (reference to current desktop) to "${matchingImages[0].path}"` + await $`osascript -e ${command}` +} else { + await $`eval ${config.applyWallpaperCommand.replace("%s", matchingImages[0].path)}` } -console.info(`Success! Enjoy :)`) +console.info(`Success! Enjoy :)`) \ No newline at end of file -- 2.51.2