diff --git a/src/apply/index.ts b/src/apply/index.ts index 76bdf4c..67e6cc1 100644 --- a/src/apply/index.ts +++ b/src/apply/index.ts @@ -88,16 +88,20 @@ if (Deno.build.os != "windows") { await $`eval ${config.applyWallpaperCommand.replace("%s", targetImage.path)}` } else { // C# in TypeScript. who would've thought + // uiAction: SPI_SetDeskWallpaper = 0x0014 = 20 + // uiParam: unused = 0 + // pvParam: path to the image + // fWinIni: SPIF_SENDCHANGE (update user profile + broadcast setting change) = 0x02 = 2 const command = ` $code = @' using System.Runtime.InteropServices; namespace Win32 { public class Wallpaper { [DllImport("user32.dll", CharSet=CharSet.Auto)] - static extern int SystemParametersInfo (int uAction, int uParam, string lpvParam, int fuWinIni); + static extern int SystemParametersInfoA(int uiAction, int uiParam, string pvParam, int fWinIni); public static void SetWallpaper(string imagePath){ - SystemParametersInfo(20, 0, imagePath, 3); + SystemParametersInfo(20, 0, imagePath, 2); } } }