// uses mode "fit to screen" static void wallpaper(S imageID) { print("Setting wallpaper to: " + imageID); if (isLinux()) { File img = loadImageAsFile(imageID); S cmd = "pcmanfm " + bashQuote("--set-wallpaper=" + img) + " --wallpaper-mode=fit"; print(backtick(cmd)); print("Wallpaper set to " + imageID + ", hopefully."); } else if (isWindows()) { File img = prepareProgramFile("#1004273", parseSnippetID(imageID) + ".bmp"); saveBMP(loadImage2(imageID), img); assertTrue(img.getAbsolutePath(), img.isFile()); S cmd = "reg add \"HKEY_CURRENT_USER\\Control Panel\\Desktop\" /v Wallpaper /t REG_SZ /d " + bashQuote(img) + " /f"; backtick(cmd); // Set to "fit" (WallpaperStyle=6, TileWallpaper=0) doesn't seem to work // So set to "center" cmd = "reg add \"HKEY_CURRENT_USER\\Control Panel\\Desktop\" /v WallpaperStyle /t REG_SZ /d " + 0 + " /f"; backtick(cmd); cmd = "reg add \"HKEY_CURRENT_USER\\Control Panel\\Desktop\" /v TileWallpaper /t REG_SZ /d " + 0 + " /f"; backtick(cmd); cmd = "RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters"; backtick(cmd); } else fail("Don't know how to set wallpaper for your OS"); print("Wallpaper set (hopefully)!"); }