Adding setting of wallpaper

This commit is contained in:
Zackarias Montell
2026-01-22 13:15:56 +01:00
parent 75e76832ff
commit 267ac0e430

View File

@@ -28,7 +28,11 @@ param (
[Alias('no-fonts')]
[switch]$NoFonts,
[Alias('only-fonts')]
[switch]$OnlyFonts
[switch]$OnlyFonts,
[Alias('no-wallpaper')]
[switch]$NoWallpaper,
[Alias('only-wallpaper')]
[switch]$OnlyWallpaper
)
if ($Help)
@@ -74,6 +78,7 @@ $Flags = [ordered]@{
PipEnabled = -not $NoPip
NpmEnabled = -not $NoNpm
FontsEnabled = -not $NoFonts
WallpaperEnabled = -not $NoWallpaper
}
function Reset-Flags
@@ -119,6 +124,11 @@ if ($OnlyFonts)
Reset-Flags
$Flags.FontsEnabled = $true
}
if ($OnlyWallpaper)
{
Reset-Flags
$Flags.WallpaperEnabled = $true
}
Write-Host "These providers are enabled:"
foreach ($key in $Flags.Keys)
@@ -238,5 +248,21 @@ if ($Flags.FontsEnabled)
Remove-Item ~\fonts -Force -Recurse| Out-Null
}
if ($Flags.WallpaperEnabled)
{
Write-Divider
Write-Host "Setting Wallpaper"
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(
int uAction, int uParam, string lpvParam, int fuWinIni);
}
"@ -ErrorAction SilentlyContinue
[Wallpaper]::SystemParametersInfo(20, 0, "$HOME\wallpaper.png", 0x03) | Out-Null
}
Write-Divider
Write-Host "Done!"