Skip to content

Commit 29f76df

Browse files
committed
fix: lockscreen
1 parent d038374 commit 29f76df

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/playbook/Configuration/tweaks/qol/appearance/atlas-theme.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ actions:
1212
# Set lockscreen
1313
- !run:
1414
exe: 'powershell.exe'
15-
args: '-NoP -EP Unrestricted -File "LOCKSCREEN.ps1"'
15+
args: '-NoP -EP Unrestricted & """LOCKSCREEN.ps1"""'
1616
exeDir: true
1717
runas: currentUserElevated
1818
- !taskKill: {name: 'SystemSettings', ignoreErrors: true}
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
# Credit: https://superuser.com/a/1343640
22
$imagePath = "$env:windir\AtlasModules\Wallpapers\lockscreen.png"
33

4-
$newImagePath = $(Split-Path $imagePath) + '\' + (New-Guid).Guid + [System.IO.Path]::GetExtension($imagePath)
4+
$newImagePath = [System.IO.Path]::GetDirectoryName($imagePath) + '\' + (New-Guid).Guid + [System.IO.Path]::GetExtension($imagePath)
55
Copy-Item $imagePath $newImagePath
66
[Windows.System.UserProfile.LockScreen,Windows.System.UserProfile,ContentType=WindowsRuntime] | Out-Null
77
Add-Type -AssemblyName System.Runtime.WindowsRuntime
88
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
9-
function Await($WinRtTask, $ResultType) {
9+
Function Await($WinRtTask, $ResultType) {
1010
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
1111
$netTask = $asTask.Invoke($null, @($WinRtTask))
1212
$netTask.Wait(-1) | Out-Null
1313
$netTask.Result
1414
}
15-
function AwaitAction($WinRtAction) {
15+
Function AwaitAction($WinRtAction) {
1616
$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and !$_.IsGenericMethod })[0]
1717
$netTask = $asTask.Invoke($null, @($WinRtAction))
1818
$netTask.Wait(-1) | Out-Null
1919
}
2020
[Windows.Storage.StorageFile,Windows.Storage,ContentType=WindowsRuntime] | Out-Null
21-
$image = Await ([Windows.Storage.StorageFile]::GetFileFromPathAsync("$env:windir\AtlasModules\Wallpapers\lockscreen.png")) ([Windows.Storage.StorageFile])
22-
AwaitAction ([Windows.System.UserProfile.LockScreen]::SetImageFileAsync($image))
21+
$image = Await ([Windows.Storage.StorageFile]::GetFileFromPathAsync($newImagePath)) ([Windows.Storage.StorageFile])
22+
AwaitAction ([Windows.System.UserProfile.LockScreen]::SetImageFileAsync($image))
23+
Remove-Item $newImagePath

0 commit comments

Comments
 (0)