From adbc91e573e274a70d8c44a68773caf14f7889cc Mon Sep 17 00:00:00 2001
From: Markus Fleschutz <markus@fleschutz.de>
Date: Sun, 12 Dec 2021 12:17:30 +0100
Subject: [PATCH] Add next-*-wallpaper.ps1 scripts

---
 Docs/VoiceControl.md                              |  5 +++++
 Scripts/next-beach-wallpaper.ps1                  | 15 +++++++++++++++
 Scripts/next-city-wallpaper.ps1                   | 15 +++++++++++++++
 ...ch-wallpaper.ps1 => next-random-wallpaper.ps1} | 10 +++++++---
 4 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 Scripts/next-beach-wallpaper.ps1
 create mode 100644 Scripts/next-city-wallpaper.ps1
 rename Scripts/{switch-wallpaper.ps1 => next-random-wallpaper.ps1} (74%)

diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md
index 99086265..129292b3 100644
--- a/Docs/VoiceControl.md
+++ b/Docs/VoiceControl.md
@@ -89,6 +89,11 @@ Launches the default Web browser and plays the given game - replace [name] by: `
 When finished say: *"Close tab"* or: *"Computer, close [name] browser"* to close the Web browser.
 
 
+*"Computer, next [category] wallpaper."*
+----------------------------------------
+Replaces the desktop background by a random photo from Unsplash, just replace [category] by: `beach`, `city`, or `random`.
+
+
 *"Computer, open [name] settings."*
 ----------------------------------
 Launches the Windows settings - replace [name] by: `activation`, `apps`, `background`, `backup`, `bluetooth`, `color`, `date`, `default apps`, `developer`, `display`, `ethernet`, `lockscreen`, `maps`, `printer`, `proxy`, `recovery`, `speech`, `start`, `system` *(the top level settings!)*, `taskbar`, `themes`, `time`, `update`, `USB`, `VPN`, or `Wifi`.
diff --git a/Scripts/next-beach-wallpaper.ps1 b/Scripts/next-beach-wallpaper.ps1
new file mode 100644
index 00000000..c0d5a9f8
--- /dev/null
+++ b/Scripts/next-beach-wallpaper.ps1
@@ -0,0 +1,15 @@
+<#
+.SYNOPSIS
+	Switches to a beach wallpaper
+.DESCRIPTION
+	This script downloads a random beach photo and sets it as desktop wallpaper.
+.EXAMPLE
+	PS> ./switch-to-beach-wallpaper
+.NOTES
+	Author: Markus Fleschutz · License: CC0
+.LINK
+	https://github.com/fleschutz/PowerShell
+#>
+
+& "$PSScriptRoot/switch-wallpaper.ps1" -Category "beach"
+exit 0 # success
\ No newline at end of file
diff --git a/Scripts/next-city-wallpaper.ps1 b/Scripts/next-city-wallpaper.ps1
new file mode 100644
index 00000000..c7af9e1f
--- /dev/null
+++ b/Scripts/next-city-wallpaper.ps1
@@ -0,0 +1,15 @@
+<#
+.SYNOPSIS
+	Switches to a city wallpaper
+.DESCRIPTION
+	This script downloads a random city photo and sets it as desktop wallpaper.
+.EXAMPLE
+	PS> ./switch-to-city-wallpaper
+.NOTES
+	Author: Markus Fleschutz · License: CC0
+.LINK
+	https://github.com/fleschutz/PowerShell
+#>
+
+& "$PSScriptRoot/switch-wallpaper.ps1" -Category "city"
+exit 0 # success
\ No newline at end of file
diff --git a/Scripts/switch-wallpaper.ps1 b/Scripts/next-random-wallpaper.ps1
similarity index 74%
rename from Scripts/switch-wallpaper.ps1
rename to Scripts/next-random-wallpaper.ps1
index e958f307..6c2eea41 100644
--- a/Scripts/switch-wallpaper.ps1
+++ b/Scripts/next-random-wallpaper.ps1
@@ -3,14 +3,18 @@
 	Switches to a random wallpaper
 .DESCRIPTION
 	This script downloads a random photo and sets it as desktop wallpaper.
+.PARAMETER Category
+	Specifies the photo category (beach, city, ...)
 .EXAMPLE
-	PS> ./switch-wallpaper
+	PS> ./switch-wallpaper beach
 .NOTES
 	Author: Markus Fleschutz · License: CC0
 .LINK
 	https://github.com/fleschutz/PowerShell
 #>
 
+param([string]$Category = "")
+
 function GetTempDir {
         if ("$env:TEMP" -ne "") { return "$env:TEMP" }
         if ("$env:TMP" -ne "")  { return "$env:TMP" }
@@ -19,10 +23,10 @@ function GetTempDir {
 }
 
 try {
-	& "$PSScriptRoot/give-reply.ps1" "Loading one from Unsplash..."
+	& "$PSScriptRoot/give-reply.ps1" "Loading from Unsplash..."
 
 	$Path = "$(GetTempDir)/next_wallpaper.jpg"
-	& wget -O $Path "https://picsum.photos/3840/2160"
+	& wget -O $Path "https://source.unsplash.com/3840x2160?$Category"
 	if ($lastExitCode -ne "0") { throw "Download failed" }
 
 	& "$PSScriptRoot/set-wallpaper.ps1" -ImageFile "$Path"