From 9e9804b1b143529e063ee7ae1bf323fe7e18f5d3 Mon Sep 17 00:00:00 2001 From: Derek Cooper Date: Mon, 30 Mar 2026 11:03:24 -0700 Subject: [PATCH] Changed the way Notifications work since they are fired as background processes --- README.md | 8 +- scripts/Invoke-ReplaySave.ps1 | 95 +++----------------- scripts/Show-Notification.ps1 | 141 ++++++++++++++++++++++++++++++ scripts/Start-OBSReplayBuffer.ps1 | 111 +++-------------------- 4 files changed, 172 insertions(+), 183 deletions(-) create mode 100644 scripts/Show-Notification.ps1 diff --git a/README.md b/README.md index 4be876b..5cb6c7e 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ IT support tool that runs OBS Studio's replay buffer silently on VDI sessions, g |---|---| | **DEM Logon Task** | Runs `Start-OBSReplayBuffer.ps1` at logon — only DEM task required | | **`config.psd1`** | Central config — UNC path, buffer duration, OBS executable path, IT contact number | -| **`Start-OBSReplayBuffer.ps1`** | Validates project files (with retry), deploys OBS config, creates user capture folder, writes OBS profile, launches OBS, confirms replay buffer started via log, shows startup notification, launches tray icon | +| **`Start-OBSReplayBuffer.ps1`** | Validates project files (with retry), deploys OBS config, creates user capture folder, writes OBS profile, launches OBS, confirms replay buffer started via log, launches startup notification, launches tray icon | | **`Show-ReplayTray.ps1`** | WinForms system tray icon — right-click menu with Save Replay / Exit | -| **`Invoke-ReplaySave.ps1`** | Sends `SaveReplayBuffer` to OBS via WebSocket v5, verifies the file was written to disk, shows save confirmation popup | +| **`Invoke-ReplaySave.ps1`** | Sends `SaveReplayBuffer` to OBS via WebSocket v5, verifies the file was written to disk, launches save confirmation notification | +| **`Show-Notification.ps1`** | WPF popup launched as a separate interactive process — handles both `BufferStarted` and `ReplaySaved` notification types via `-Type` parameter | | **`obs-config/`** | OBS config files — deployed to `%APPDATA%\obs-studio\` at logon by the script | ## Repository Structure @@ -32,7 +33,8 @@ obs-replay-buffer/ ├── scripts/ │ ├── Start-OBSReplayBuffer.ps1 │ ├── Show-ReplayTray.ps1 -│ └── Invoke-ReplaySave.ps1 +│ ├── Invoke-ReplaySave.ps1 +│ └── Show-Notification.ps1 └── obs-config/ ├── global.ini └── scenes/ diff --git a/scripts/Invoke-ReplaySave.ps1 b/scripts/Invoke-ReplaySave.ps1 index 28bbbd0..4c25307 100644 --- a/scripts/Invoke-ReplaySave.ps1 +++ b/scripts/Invoke-ReplaySave.ps1 @@ -92,88 +92,19 @@ try { Write-Host "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [INFO] Replay file confirmed: $($savedFile.FullName) ($fileSizeMB MB)" # --- Notify user that the replay was saved --- - $notifyScript = { - param($fileName, $fileSizeMB, $contactNumber) - - Add-Type -AssemblyName PresentationFramework - Add-Type -AssemblyName WindowsBase - Add-Type -AssemblyName System.Drawing - - $hBitmap = [System.Drawing.SystemIcons]::Shield.ToBitmap().GetHbitmap() - $wpfImage = [System.Windows.Interop.Imaging]::CreateBitmapSourceFromHBitmap( - $hBitmap, [IntPtr]::Zero, [System.Windows.Int32Rect]::Empty, - [System.Windows.Media.Imaging.BitmapSizeOptions]::FromEmptyOptions() - ) - [System.Runtime.InteropServices.Marshal]::DeleteObject($hBitmap) - - [xml]$xaml = @" - - - - - - - - - - - - - - -