// Linux version is for Gnome only static void wallpaper(S imageID) { wallpaper(loadImageAsFile(imageID), imageID); } // uses mode "fit to screen" static void wallpaper(File img1, S description) { print("Setting wallpaper to: " + description + " (" + img1.getName() + ")"); if (isLinux()) { print("Be sure to apt install pcmanfm!"); S cmd = "pcmanfm " + bashQuote("--set-wallpaper=" + img1) + " --wallpaper-mode=fit"; print(backtick(cmd)); } else if (isWindows()) { File img = prepareProgramFile(#1004273, img1.getName() + ".bmp"); saveBMP(loadImage2(img1), 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)!"); }