set the desktop wallpaper

This commit is contained in:
Rui Lopes 2023-07-29 12:04:08 +01:00
parent ae1c24f6fd
commit db1a0b8614
3 changed files with 321 additions and 0 deletions

View File

@ -17,6 +17,140 @@ Set-Culture pt-PT
# show window content while dragging.
Set-ItemProperty -Path 'HKCU:Control Panel\Desktop' -Name DragFullWindows -Value 1
# set the desktop wallpaper.
Add-Type -AssemblyName System.Drawing
$backgroundColor = [System.Drawing.Color]::FromArgb(30, 30, 30)
$backgroundPath = 'C:\Windows\Web\Wallpaper\Windows\sonatype-nexus-repository.png'
$logo = [System.Drawing.Image]::FromFile((Resolve-Path 'sonatype-nexus-repository.png'))
$b = New-Object System.Drawing.Bitmap($logo.Width, $logo.Height)
$g = [System.Drawing.Graphics]::FromImage($b)
$g.Clear($backgroundColor)
$g.DrawImage($logo, 0, 0, $logo.Width, $logo.Height)
$b.Save($backgroundPath)
Set-ItemProperty -Path 'HKCU:Control Panel\Desktop' -Name Wallpaper -Value $backgroundPath
Set-ItemProperty -Path 'HKCU:Control Panel\Desktop' -Name WallpaperStyle -Value 0
Set-ItemProperty -Path 'HKCU:Control Panel\Desktop' -Name TileWallpaper -Value 0
Set-ItemProperty -Path 'HKCU:Control Panel\Colors' -Name Background -Value ($backgroundColor.R,$backgroundColor.G,$backgroundColor.B -join ' ')
Add-Type @'
using System;
using System.Drawing;
using System.Runtime.InteropServices;
public static class WindowsWallpaper
{
private const int COLOR_DESKTOP = 0x01;
[DllImport("user32", SetLastError=true)]
private static extern bool SetSysColors(int cElements, int[] lpaElements, int[] lpaRgbValues);
private const uint SPI_SETDESKWALLPAPER = 0x14;
private const uint SPIF_UPDATEINIFILE = 0x01;
private const uint SPIF_SENDWININICHANGE = 0x02;
[DllImport("user32", SetLastError=true)]
private static extern bool SystemParametersInfo(uint uiAction, uint uiParam, string pvParam, uint fWinIni);
public static void Set(Color color, string path)
{
var elements = new int[] { COLOR_DESKTOP };
var colors = new int[] { ColorTranslator.ToWin32(color) };
SetSysColors(elements.Length, elements, colors);
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, path, SPIF_SENDWININICHANGE);
}
}
'@ -ReferencedAssemblies System.Drawing
[WindowsWallpaper]::Set($backgroundColor, $backgroundPath)
# cleanup the taskbar by removing the existing buttons and unpinning all applications; once the user logs on.
# NB the shell executes these RunOnce commands about ~10s after the user logs on.
$configureDesktopScript = @'
# unpin all applications from the taskbar.
# NB this can only be done in a logged on session.
$pinnedTaskbarPath = "$env:APPDATA\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
(New-Object -Com Shell.Application).NameSpace($pinnedTaskbarPath).Items() `
| ForEach-Object {
$unpinVerb = $_.Verbs() | Where-Object { $_.Name -eq 'Unpin from tas&kbar' }
if ($unpinVerb) {
$unpinVerb.DoIt()
} else {
$shortcut = (New-Object -Com WScript.Shell).CreateShortcut($_.Path)
if (!$shortcut.TargetPath -and ($shortcut.IconLocation -eq '%windir%\explorer.exe,0')) {
Remove-Item -Force $_.Path
}
}
}
Get-Item HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Taskband `
| Set-ItemProperty -Name Favorites -Value 0xff `
| Set-ItemProperty -Name FavoritesResolve -Value 0xff `
| Set-ItemProperty -Name FavoritesVersion -Value 3 `
| Set-ItemProperty -Name FavoritesChanges -Value 1 `
| Set-ItemProperty -Name FavoritesRemovedChanges -Value 1
# hide the search button.
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name SearchboxTaskbarMode -Value 0
# hide the task view button.
Set-ItemProperty -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowTaskViewButton -Value 0
# never combine the taskbar buttons.
# possibe values:
# 0: always combine and hide labels (default)
# 1: combine when taskbar is full
# 2: never combine
Set-ItemProperty -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarGlomLevel -Value 2
# remove default or uneeded files.
@(
"$env:USERPROFILE\Desktop\desktop.ini"
"$env:USERPROFILE\Desktop\*.lnk"
"$env:USERPROFILE\Desktop\*.url"
"$env:PUBLIC\Desktop\desktop.ini"
"$env:PUBLIC\Desktop\*.lnk"
"$env:PUBLIC\Desktop\*.url"
) | Remove-Item -Force
# add desktop shortcuts.
@(
,('Nexus', 'https://@@NEXUS_DOMAIN@@')
) | ForEach-Object {
if ($_[1] -like 'http*') {
[IO.File]::WriteAllText("$env:USERPROFILE\Desktop\$($_[0]).url", @"
[InternetShortcut]
URL=$($_[1])
"@)
} elseif (!(Test-Path $_[1])) {
return
} elseif ($_[1] -like '*.lnk') {
Copy-Item $_[1] "$env:USERPROFILE\Desktop\$($_[0]).lnk"
} else {
$extraArguments = @{
IconLocation = $_[1]
}
if ($_.Length -gt 2) {
$extraArguments.Arguments = $_[2]
$extraArguments.IconLocation = $_[3]
$extraArguments.WorkingDirectory = $_[4]
}
# add into the Desktop.
Install-ChocolateyShortcut `
-ShortcutFilePath "$env:USERPROFILE\Desktop\$($_[0]).lnk" `
-TargetPath $_[1] `
@extraArguments
# add into the Start Menu.
Copy-Item `
"$env:USERPROFILE\Desktop\$($_[0]).lnk" `
"C:\Users\All Users\Microsoft\Windows\Start Menu\Programs"
}
}
# restart explorer to apply the changed settings.
(Get-Process explorer).Kill()
'@ -replace '@@NEXUS_DOMAIN@@',$nexusDomain
[IO.File]::WriteAllText("$env:USERPROFILE\ConfigureDesktop.ps1", $configureDesktopScript)
New-Item -Path HKCU:Software\Microsoft\Windows\CurrentVersion\RunOnce -Force `
| New-ItemProperty -Name ConfigureDesktop -Value 'PowerShell -WindowStyle Hidden -File "%USERPROFILE%\ConfigureDesktop.ps1"' -PropertyType ExpandString `
| Out-Null
# show hidden files.
Set-ItemProperty -Path HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Value 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
id="Layer_1"
data-name="Layer 1"
viewBox="0 0 212.85008 45.850078"
version="1.1"
sodipodi:docname="sonatype-nexus-repository.svg"
width="532.11188"
height="114.62233"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
inkscape:export-filename="/home/vagrant/Projects/nexus-vagrant/provision/sonatype-nexus-repository.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview68"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
scale-x="0.40001"
fit-margin-top="4"
fit-margin-left="4"
fit-margin-right="4"
fit-margin-bottom="4"
inkscape:zoom="1"
inkscape:cx="225.5"
inkscape:cy="24"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1"
lock-margins="true" />
<defs
id="defs4">
<style
id="style2">
.cls-1 {
fill: #fff;
}
.cls-2 {
fill: #05b96c;
}
.cls-3 {
fill: #05bb6d;
}
</style>
</defs>
<g
id="g17"
transform="translate(-0.13995997,0.07004003)">
<g
id="Sonatype_Logo_Favicon"
data-name="Sonatype Logo Favicon">
<polygon
class="cls-3"
points="15.29,31.11 12.55,29.53 1.74,23.33 1.74,18.82 5.78,21.14 5.78,21.17 16.46,27.28 19.22,28.86 19.24,28.87 19.26,28.86 22.01,27.29 32.69,21.17 32.69,21.13 36.74,18.81 36.74,23.33 25.92,29.54 23.18,31.12 23.17,31.12 19.24,33.37 "
id="polygon6" />
</g>
<g
id="Sonatype_Logo_Favicon-2"
data-name="Sonatype Logo Favicon">
<polygon
class="cls-1"
points="15.29,38.39 12.55,36.81 1.74,30.61 1.74,26.1 5.78,28.42 5.78,28.45 16.46,34.56 19.22,36.15 19.24,36.16 19.26,36.15 22.01,34.57 32.69,28.45 32.69,28.41 36.74,26.09 36.74,30.61 25.92,36.82 23.18,38.4 23.17,38.4 19.24,40.65 "
id="polygon9" />
</g>
<g
id="Sonatype_Logo_Favicon-3"
data-name="Sonatype Logo Favicon">
<path
class="cls-1"
d="m 32.69,6.81 v 7.08 l -10.68,6.12 -2.75,1.58 h -0.02 c 0,0 -0.02,0 -0.02,0 L 16.46,20 5.79,13.89 V 6.81 H 1.74 v 9.24 l 10.8,6.2 2.75,1.58 3.94,2.26 3.93,-2.25 2.75,-1.57 10.82,-6.21 V 6.81 h -4.05 z"
id="path12" />
</g>
<path
class="cls-2"
d="M 19.88,15.14 V 7.73 c 0.49,-0.72 1.8,-1.28 2.78,-1.28 0.35,0 0.61,0.02 0.82,0.07 V 3.64 c -1.4,0 -2.78,0.81 -3.6,1.79 V 3.92 h -2.96 v 11.21 h 2.96 z"
id="path15" />
</g>
<g
id="g65"
transform="translate(-0.13995997,0.07004003)">
<path
class="cls-1"
d="m 47.22,14.2 1.1,-1.72 c 0.78,0.8 2.32,1.54 3.75,1.54 1.43,0 2.21,-0.6 2.21,-1.47 0,-2.18 -6.71,-0.62 -6.71,-4.9 0,-1.82 1.56,-3.36 4.37,-3.36 1.88,0 3.31,0.67 4.3,1.54 l -1.01,1.7 C 54.56,6.79 53.35,6.2 51.94,6.2 c -1.27,0 -2.05,0.6 -2.05,1.38 0,1.95 6.71,0.48 6.71,4.9 0,1.98 -1.63,3.47 -4.62,3.47 -1.91,0 -3.61,-0.62 -4.76,-1.75 z"
id="path19" />
<path
class="cls-1"
d="m 57.43,10.11 c 0,-3.2 2.16,-5.82 5.7,-5.82 3.54,0 5.7,2.62 5.7,5.82 0,3.2 -2.16,5.84 -5.7,5.84 -3.54,0 -5.7,-2.67 -5.7,-5.84 z m 8.9,0 c 0,-1.96 -1.13,-3.68 -3.2,-3.68 -2.07,0 -3.2,1.72 -3.2,3.68 0,1.96 1.15,3.7 3.2,3.7 2.05,0 3.2,-1.72 3.2,-3.7 z"
id="path21" />
<path
class="cls-1"
d="M 78.13,15.67 V 8.73 c 0,-1.75 -0.9,-2.3 -2.25,-2.3 -1.22,0 -2.28,0.74 -2.85,1.47 v 7.77 H 70.62 V 4.56 h 2.41 v 1.49 c 0.74,-0.87 2.19,-1.77 3.93,-1.77 2.39,0 3.59,1.29 3.59,3.56 v 7.82 h -2.41 z"
id="path23" />
<path
class="cls-1"
d="m 89.91,15.67 v -1.22 c -0.83,0.97 -2.14,1.5 -3.61,1.5 -1.79,0 -3.84,-1.24 -3.84,-3.68 0,-2.58 2.02,-3.63 3.84,-3.63 1.52,0 2.78,0.48 3.61,1.43 V 8.41 c 0,-1.29 -1.08,-2.07 -2.6,-2.07 -1.24,0 -2.35,0.46 -3.29,1.43 L 83.01,6.09 c 1.29,-1.24 2.9,-1.79 4.67,-1.79 2.48,0 4.64,1.04 4.64,4 v 7.38 h -2.41 z m 0,-2.53 v -1.7 c -0.57,-0.76 -1.61,-1.15 -2.64,-1.15 -1.36,0 -2.39,0.8 -2.39,2 0,1.2 1.04,2 2.39,2 1.04,0 2.07,-0.39 2.64,-1.15 z"
id="path25" />
<path
class="cls-1"
d="M 95.73,13.07 V 6.65 H 93.89 V 4.56 h 1.84 V 1.53 h 2.41 v 3.04 h 2.25 v 2.09 h -2.25 v 5.82 c 0,0.76 0.37,1.33 1.06,1.33 0.46,0 0.87,-0.21 1.06,-0.41 l 0.58,1.84 c -0.44,0.39 -1.15,0.71 -2.25,0.71 -1.89,0 -2.85,-1.01 -2.85,-2.88 z"
id="path27" />
<path
class="cls-1"
d="m 102.79,17.86 c 0.25,0.12 0.64,0.18 0.92,0.18 0.78,0 1.29,-0.23 1.61,-0.97 l 0.55,-1.26 -4.58,-11.24 h 2.6 l 3.24,8.32 3.24,-8.32 h 2.58 l -5.36,13.11 c -0.76,1.88 -2.07,2.48 -3.79,2.51 -0.35,0 -1.04,-0.07 -1.36,-0.16 l 0.35,-2.16 z"
id="path29" />
<path
class="cls-1"
d="M 116.61,14.13 V 19.9 H 114.2 V 4.56 h 2.41 v 1.52 c 0.83,-1.1 2.12,-1.79 3.56,-1.79 2.88,0 4.92,2.16 4.92,5.82 0,3.66 -2.04,5.84 -4.92,5.84 -1.4,0 -2.64,-0.64 -3.56,-1.82 z m 6,-4.02 c 0,-2.16 -1.24,-3.68 -3.15,-3.68 -1.13,0 -2.3,0.64 -2.85,1.47 v 4.39 c 0.53,0.83 1.72,1.52 2.85,1.52 1.91,0 3.15,-1.54 3.15,-3.7 z"
id="path31" />
<path
class="cls-1"
d="m 126.41,10.11 c 0,-3.22 2.35,-5.82 5.63,-5.82 3.28,0 5.45,2.53 5.45,6.03 v 0.6 h -8.55 c 0.18,1.66 1.43,3.06 3.52,3.06 1.1,0 2.37,-0.44 3.17,-1.24 l 1.1,1.59 c -1.13,1.06 -2.76,1.63 -4.51,1.63 -3.36,0 -5.82,-2.32 -5.82,-5.84 z m 5.61,-3.84 c -2.05,0 -3.01,1.59 -3.11,2.92 h 6.26 C 135.1,7.88 134.2,6.27 132.02,6.27 Z"
id="path33" />
<path
class="cls-3"
d="m 55.55,39.67 v -6.71 c 0,-1.54 -0.8,-2.07 -2.05,-2.07 -1.15,0 -2.02,0.64 -2.53,1.29 v 7.5 H 48.05 V 28.57 h 2.92 V 30 c 0.71,-0.83 2.09,-1.7 3.89,-1.7 2.46,0 3.63,1.38 3.63,3.54 v 7.84 h -2.94 z"
id="path35" />
<path
class="cls-3"
d="m 59.62,34.11 c 0,-3.22 2.39,-5.82 5.75,-5.82 3.36,0 5.56,2.48 5.56,6.09 v 0.69 h -8.26 c 0.21,1.36 1.31,2.48 3.2,2.48 0.94,0 2.23,-0.39 2.94,-1.08 l 1.31,1.93 c -1.1,1.01 -2.85,1.54 -4.58,1.54 -3.38,0 -5.93,-2.28 -5.93,-5.84 z m 5.75,-3.43 c -1.82,0 -2.6,1.26 -2.71,2.37 h 5.47 C 68.04,31.99 67.3,30.68 65.37,30.68 Z"
id="path37" />
<path
class="cls-3"
d="m 78.98,39.67 -2.53,-3.75 -2.55,3.75 h -3.24 l 3.96,-5.7 -3.73,-5.4 h 3.27 l 2.3,3.4 2.28,-3.4 h 3.27 l -3.7,5.4 3.96,5.7 H 79 Z"
id="path39" />
<path
class="cls-3"
d="m 90.62,39.67 v -1.4 c -0.76,0.83 -2.09,1.68 -3.91,1.68 -2.44,0 -3.59,-1.33 -3.59,-3.5 v -7.89 h 2.92 v 6.74 c 0,1.54 0.8,2.05 2.05,2.05 1.13,0 2.02,-0.62 2.53,-1.26 v -7.52 h 2.92 v 11.11 h -2.92 z"
id="path41" />
<path
class="cls-3"
d="m 94.9,38.22 1.27,-2.12 c 0.83,0.78 2.46,1.54 3.84,1.54 1.27,0 1.86,-0.48 1.86,-1.17 0,-1.82 -6.58,-0.32 -6.58,-4.69 0,-1.86 1.61,-3.5 4.55,-3.5 1.86,0 3.36,0.64 4.46,1.52 l -1.17,2.07 c -0.67,-0.69 -1.93,-1.29 -3.29,-1.29 -1.06,0 -1.75,0.46 -1.75,1.08 0,1.63 6.6,0.25 6.6,4.74 0,2.05 -1.75,3.54 -4.83,3.54 -1.93,0 -3.79,-0.64 -4.97,-1.72 z"
id="path43" />
<path
class="cls-3"
d="M 111.62,39.67 V 28.56 h 2.92 v 1.49 c 0.8,-0.97 2.16,-1.77 3.54,-1.77 v 2.85 c -0.21,-0.05 -0.46,-0.07 -0.8,-0.07 -0.97,0 -2.25,0.55 -2.74,1.27 v 7.33 h -2.92 z"
id="path45" />
<path
class="cls-3"
d="m 118.61,34.11 c 0,-3.22 2.39,-5.82 5.75,-5.82 3.36,0 5.56,2.48 5.56,6.09 v 0.69 h -8.26 c 0.21,1.36 1.31,2.48 3.2,2.48 0.94,0 2.23,-0.39 2.94,-1.08 l 1.31,1.93 c -1.1,1.01 -2.85,1.54 -4.58,1.54 -3.38,0 -5.93,-2.28 -5.93,-5.84 z m 5.75,-3.43 c -1.82,0 -2.6,1.26 -2.71,2.37 h 5.47 c -0.09,-1.06 -0.83,-2.37 -2.76,-2.37 z"
id="path47" />
<path
class="cls-3"
d="m 134.28,38.25 v 5.66 h -2.92 V 28.57 h 2.92 v 1.4 c 0.85,-1.08 2.07,-1.68 3.43,-1.68 2.85,0 4.92,2.12 4.92,5.82 0,3.7 -2.07,5.84 -4.92,5.84 -1.31,0 -2.51,-0.55 -3.43,-1.7 z m 5.34,-4.14 c 0,-1.91 -1.15,-3.22 -2.83,-3.22 -0.94,0 -2,0.53 -2.51,1.26 v 3.91 c 0.48,0.71 1.56,1.29 2.51,1.29 1.68,0 2.83,-1.31 2.83,-3.24 z"
id="path49" />
<path
class="cls-3"
d="m 143.59,34.11 c 0,-3.15 2.21,-5.82 5.86,-5.82 3.65,0 5.89,2.67 5.89,5.82 0,3.15 -2.21,5.84 -5.89,5.84 -3.68,0 -5.86,-2.69 -5.86,-5.84 z m 8.71,0 c 0,-1.72 -1.01,-3.22 -2.85,-3.22 -1.84,0 -2.83,1.5 -2.83,3.22 0,1.72 1.01,3.24 2.83,3.24 1.82,0 2.85,-1.5 2.85,-3.24 z"
id="path51" />
<path
class="cls-3"
d="m 155.99,38.22 1.27,-2.12 c 0.83,0.78 2.46,1.54 3.84,1.54 1.26,0 1.86,-0.48 1.86,-1.17 0,-1.82 -6.58,-0.32 -6.58,-4.69 0,-1.86 1.61,-3.5 4.55,-3.5 1.86,0 3.36,0.64 4.46,1.52 l -1.17,2.07 c -0.67,-0.69 -1.93,-1.29 -3.29,-1.29 -1.06,0 -1.75,0.46 -1.75,1.08 0,1.63 6.6,0.25 6.6,4.74 0,2.05 -1.75,3.54 -4.83,3.54 -1.93,0 -3.79,-0.64 -4.97,-1.72 z"
id="path53" />
<path
class="cls-3"
d="m 167.07,25.62 c 0,-0.97 0.78,-1.72 1.72,-1.72 0.94,0 1.75,0.76 1.75,1.72 0,0.96 -0.78,1.75 -1.75,1.75 -0.97,0 -1.72,-0.78 -1.72,-1.75 z m 0.28,14.05 V 28.56 h 2.92 v 11.11 z"
id="path55" />
<path
class="cls-3"
d="m 173.65,36.89 v -5.77 h -1.84 v -2.55 h 1.84 v -3.04 h 2.92 v 3.04 h 2.25 v 2.55 h -2.25 v 4.99 c 0,0.71 0.37,1.24 1.01,1.24 0.44,0 0.85,-0.16 1.01,-0.34 l 0.62,2.23 c -0.44,0.39 -1.22,0.71 -2.44,0.71 -2.05,0 -3.13,-1.06 -3.13,-3.06 z"
id="path57" />
<path
class="cls-3"
d="m 179.08,34.11 c 0,-3.15 2.21,-5.82 5.86,-5.82 3.65,0 5.89,2.67 5.89,5.82 0,3.15 -2.21,5.84 -5.89,5.84 -3.68,0 -5.86,-2.69 -5.86,-5.84 z m 8.71,0 c 0,-1.72 -1.01,-3.22 -2.85,-3.22 -1.84,0 -2.83,1.5 -2.83,3.22 0,1.72 1.01,3.24 2.83,3.24 1.82,0 2.85,-1.5 2.85,-3.24 z"
id="path59" />
<path
class="cls-3"
d="M 191.98,39.67 V 28.56 h 2.92 v 1.49 c 0.8,-0.97 2.16,-1.77 3.54,-1.77 v 2.85 c -0.21,-0.05 -0.46,-0.07 -0.8,-0.07 -0.96,0 -2.25,0.55 -2.74,1.27 v 7.33 h -2.92 z"
id="path61" />
<path
class="cls-3"
d="m 200.95,41.4 c 0.25,0.12 0.64,0.18 0.92,0.18 0.76,0 1.27,-0.21 1.54,-0.8 l 0.41,-0.97 -4.51,-11.24 h 3.13 l 2.9,7.73 2.92,-7.73 h 3.13 l -5.22,12.92 c -0.83,2.09 -2.3,2.64 -4.21,2.69 -0.32,0 -1.08,-0.07 -1.43,-0.18 l 0.41,-2.6 z"
id="path63" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB