Add next-*-wallpaper.ps1 scripts

This commit is contained in:
Markus Fleschutz 2021-12-12 12:17:30 +01:00
parent 49c61532f1
commit adbc91e573
4 changed files with 42 additions and 3 deletions

View File

@ -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`.

View File

@ -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

View File

@ -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

View File

@ -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"