import "@johnlindquist/kit"
const wallpapersPath = await env('WALLPAPER_PATH');
const availableWallpapers = ls(wallpapersPath);
const selectedWallpaper = await arg('select', availableWallpapers.map(image => {
const imagePath = path.resolve(wallpapersPath, image);
return {
name: image,
preview: `<img src="${imagePath}">`,
value: imagePath
};
}));
await applescript(`tell application "Finder" to set desktop picture to POSIX file "${selectedWallpaper}"`);