From 0e25012ba5a3d48094abedec66c791cdc68c18c4 Mon Sep 17 00:00:00 2001 From: Angel Wang Date: Mon, 22 Jun 2026 21:15:15 -0600 Subject: [PATCH] fix: pull correct user32 method also docs --- src/apply/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); } } } -- 2.51.2