Release v0.6.0: screenshot notifications with previews and responsive clipboard history

This commit is contained in:
2026-10-29 00:01:04 +02:00
parent ccaa8dad3f
commit dd9629f8fd
19 changed files with 501 additions and 41 deletions
+15 -10
View File
@@ -35,24 +35,29 @@ function Select-Region($Window) {
Send $Window 0x201 1 ((40 -shl 16) -bor 40)
Send $Window 0x200 1 ((240 -shl 16) -bor 360)
Send $Window 0x202 0 ((240 -shl 16) -bor 360)
Wait-For { [ScreenshotProcessTest]::Title($Window) -match 'Screenshot #' } 'Selection did not become an editor.'
Wait-For { (Capture-Windows) -notcontains $Window } 'Selection did not close after copying (notifications may be disabled).'
}
function Close-Editor($Window) {
Send $Window 0x10
Wait-For { @([ScreenshotProcessTest]::Windows($script:process.Id,'#32770')).Count -eq 1 } 'Missing close confirmation.'
$dialog=[ScreenshotProcessTest]::Windows($script:process.Id,'#32770')[0]
Send $dialog (0x400+102) 6 # TDM_CLICK_BUTTON / IDYES; no clipboard writes.
Wait-For { (Capture-Windows) -notcontains $Window } 'Editor did not close.'
Wait-For { (Capture-Windows) -notcontains $Window } 'Unedited copied screenshot did not close.'
}
function Latest-Token {
(Get-ChildItem -LiteralPath (Join-Path $env:LOCALAPPDATA 'KSwitcher/ScreenshotNotifications') -Filter '*.capture' | Sort-Object LastWriteTimeUtc -Descending | Select-Object -First 1).BaseName
}
$process=$null
try {
$process=Start-Process -FilePath $Executable -WindowStyle Hidden -PassThru
Wait-For { (Capture-Windows).Count -eq 1 } 'First selection did not open.'
$first=(Capture-Windows)[0]; Select-Region $first
$secondLaunch=Start-Process -FilePath $Executable -WindowStyle Hidden -PassThru
if (!$secondLaunch.WaitForExit(10000) -or $secondLaunch.ExitCode -ne 0) { throw 'Second launch did not hand off.' }
Wait-For { (Capture-Windows).Count -eq 2 } 'Second selection did not open in same process.'
$second=(Capture-Windows | Where-Object { $_ -ne $first })[0]; Select-Region $second
Select-Region (Capture-Windows)[0]
if (!$process.WaitForExit(5000)) { throw 'Process remained alive after notification.' }
$token=Latest-Token
$process=Start-Process -FilePath $Executable -ArgumentList @('--open',"kswitcher-screenshot:$token") -WindowStyle Hidden -PassThru
Wait-For { (Capture-Windows).Count -eq 1 } 'Notification activation did not open an editor.'
$first=(Capture-Windows)[0]
$secondLaunch=Start-Process -FilePath $Executable -ArgumentList @('--open',"kswitcher-screenshot:$token") -WindowStyle Hidden -PassThru
if (!$secondLaunch.WaitForExit(10000) -or $secondLaunch.ExitCode -ne 0) { throw 'Second activation did not hand off.' }
Wait-For { (Capture-Windows).Count -eq 2 } 'Second editor did not open in same process.'
$second=(Capture-Windows | Where-Object { $_ -ne $first })[0]
if ([ScreenshotProcessTest]::Title($first) -eq [ScreenshotProcessTest]::Title($second)) { throw 'Editor indices collide.' }
Close-Editor $first
if ($process.HasExited) { throw 'Process exited with an editor open.' }