Script to Make Windows Spotlight Images as Desktop Wallpaper

Zamroni1

New member
Oct 27, 2013
1
0
0
Visit site
Do you like the Spotlight wallpapers in your Windows 10 lock screen? I do. However, Microsoft doesn't give option to make Spotlight as regular desktop background. Well, the Spotlight's JPEG images are stored within your %LOCALAPPDATA% directory, so some script can process them to make it as usable desktop background images.

These are the steps:
1. Enable Spotlight in "Settings > Personalization > Lock Screen". Choose Windows Spotlight in Background drop down.

2. The Spotlight images consists of portrait and landscape images. Surely, only landscape images are suitable for desktop wallpaper, so the script checks the image resolution to determine the orientation. I use Linux's file command to check the resolution program because no such Windows equivalent exists. So, enable Windows Subsystem for Linux in "Control Panel > All Control Panel Items > Programs and Features > Turn Windows features on or off, then:
a. Restart your computer if Windows ask for it.
b. After restart, open newly created shortcut of Bash on Ubuntu on Windows. This will completely download and install required components.

3. Define and make your working directory. I use "c:\temp\spotlight". The following procedures are written according to the path of working directory and my Spotlight folder, i.e. C:\Users\mazam\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets.

4. Create "spotlight.sh" text file containing text below. Use Unix-friendly text editor, e.g. WordPad, and not Notepad.
ls -1 /mnt/c/Users/mazam/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets/ | sort > /mnt/c/temp/spotlight/listsource.txt
ls -1 /mnt/c/temp/spotlight/*.jpg | awk -F "/" '{gsub(".jpg","",$6);print $6}' | sort > /mnt/c/temp/spotlight/listtarget.txt
egrep -vf /mnt/c/temp/spotlight/listsource.txt /mnt/c/temp/spotlight/listtarget.txt | awk '{system ("rm -f "$1".jpg")}'
for i in `cat /mnt/c/temp/spotlight/listsource.txt | egrep -vf /mnt/c/temp/spotlight/listtarget.txt`
do
varfile=/mnt/c/Users/mazam/AppData/Local/Packages/Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy/LocalState/Assets/"$i"
file $varfile | grep JPEG | awk -F, '{gsub(" ","",$8);print $8}' | awk -Fx -v vfile=$i -v vfilefull=$varfile '{if ($1>$2 && $1>1280) system("cp "vfilefull" /mnt/c/temp/spotlight/"vfile".jpg")}'
done

5. (Optional) Test the script in Bash on Ubuntu on Windows. Execute /mnt/c/temp/spotlight/spotlight.sh. Check that JPEG files are created in c:\temp\spotlight.

6. Change Desktop background to Slideshow in Settings > Personalization > Background. Select your working directory as the album directory.

7. Because Spotlight images are changed automatically, we also want also desktop to follow accordingly. So, create startup mechanism to automatically update the images working directory. Create spotlight.bat text file in working directory containing text:
bash -c "/mnt/c/temp/spotlight/spotlight.sh"

8. Right click the spotlight.bat file then select Create Shortcut.

9. Move the resulted shortcut to your Startup folder. For me, it is "C:\Users\mazam\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup". File spotlight.bat will be executed every time you do new login to Windows.

10. DONE
 

Members online

Forum statistics

Threads
323,162
Messages
2,243,367
Members
428,034
Latest member
shelton786