mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-30 12:41:46 +02:00
Add next-*-wallpaper.ps1 scripts
This commit is contained in:
15
Scripts/next-beach-wallpaper.ps1
Normal file
15
Scripts/next-beach-wallpaper.ps1
Normal 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
|
15
Scripts/next-city-wallpaper.ps1
Normal file
15
Scripts/next-city-wallpaper.ps1
Normal 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
|
@ -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"
|
Reference in New Issue
Block a user