From d20b0b439e24a85aecf2525662e0dc283df52f95 Mon Sep 17 00:00:00 2001 From: X9 Dev Date: Tue, 2 Jun 2026 14:35:22 +0200 Subject: [PATCH] fix(backinfo): set desktop background color in all profiles (no black border) BackInfo paints a centered bitmap; when it is smaller than the screen the area around it shows HKCU\Control Panel\Colors\Background, which was black in profiles step 04 had not touched. Set the solid background (#223B47) in HKU\.DEFAULT and in every existing user profile (loading each hive as needed), on top of the Default hive and current user, so the border around the bitmap blends into the background. Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 5 ++++ SPEC.md | 3 +++ scripts/04-default-profile.ps1 | 48 +++++++++++++++++++++++++++++++++- web/data/descriptions.json | 2 +- web/spec/index.html | 1 + 5 files changed, 57 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e094236..71c4ed9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ Builds are continuous: every push to `main` produces a signed `xetup.exe` publis - **BackInfo background color**: use the COLORREF value `4668194` for #223B47. BackInfo uses a COLORREF (`0x00BBGGRR` / BGR), so the 0.7 value `2243399` (`0x223B47`) was read with red/blue swapped and rendered olive-brown (#473B22). Reverts the 0.7 change. +- **BackInfo black border in some profiles** (04): BackInfo paints a centered bitmap; when it is + smaller than the screen, the surrounding desktop showed black in profiles whose + `Control Panel\Colors\Background` was not set. The solid desktop background color (#223B47) is + now written to HKU\.DEFAULT and to every existing user profile (loading each hive as needed), + in addition to the Default hive and current user, so the area around the bitmap blends in. ## [0.7] - 2026-06-02 diff --git a/SPEC.md b/SPEC.md index c6e37aa..7f6946e 100644 --- a/SPEC.md +++ b/SPEC.md @@ -134,6 +134,9 @@ registry. Creates startup shortcut for all users. BackInfo renders system info B desktop wallpaper on every logon. Background is solid #223B47 (BackInfo.ini BackgroundColor = 4668194; BackInfo uses a COLORREF / 0x00BBGGRR / BGR value, so #223B47 = 71*65536 + 59*256 + 34 = 4668194. The RGB value 2243399 rendered olive-brown). +Because BackInfo paints a centered bitmap, step 04 also sets the solid desktop background color +(#223B47) in the Default hive, the current user, HKU\.DEFAULT and every existing profile - otherwise +a sub-screen bitmap shows a black border around it. --- diff --git a/scripts/04-default-profile.ps1 b/scripts/04-default-profile.ps1 index b8ffbdc..ab56ed5 100644 --- a/scripts/04-default-profile.ps1 +++ b/scripts/04-default-profile.ps1 @@ -387,7 +387,8 @@ $pinList @{ Key="Software\Microsoft\Windows\DWM"; Name="ColorPrevalence"; Val=1; Type="DWord" }, @{ Key="Software\Microsoft\Windows\CurrentVersion\Explorer\Accent"; Name="AccentColorMenu"; Val=$AccentColorABGR; Type="DWord" }, @{ Key="Software\Microsoft\Windows\CurrentVersion\Explorer\Accent"; Name="StartColorMenu"; Val=$AccentColorABGR; Type="DWord" }, - @{ Key="Software\Microsoft\Windows\CurrentVersion\Explorer\Accent"; Name="AccentPalette"; Val=$AccentPalette; Type="Binary" } + @{ Key="Software\Microsoft\Windows\CurrentVersion\Explorer\Accent"; Name="AccentPalette"; Val=$AccentPalette; Type="Binary" }, + @{ Key="Control Panel\Colors"; Name="Background"; Val="34 59 71"; Type="String" } ) foreach ($c in $defaultColors) { $cp = "Registry::HKU\.DEFAULT\$($c.Key)" @@ -401,6 +402,51 @@ $pinList } Write-Log " Theme/accent mirrored to HKU\.DEFAULT" -Level OK + # ------------------------------------------------------------------- + # Desktop background color in EVERY existing user profile + # ------------------------------------------------------------------- + # BackInfo paints a centered bitmap; if it is smaller than the screen, the + # area around it shows HKCU\Control Panel\Colors\Background. New users get + # #223B47 from the Default hive and the current user from HKCU above, but + # pre-existing profiles would show the default black border. Set the color + # in each real user profile (loading its hive if it is not already mounted). + Write-Log "Applying desktop background color to existing user profiles" -Level STEP + $profileList = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" + foreach ($pl in (Get-ChildItem $profileList -ErrorAction SilentlyContinue)) { + $sid = Split-Path $pl.Name -Leaf + if ($sid -notmatch '^S-1-5-21-') { continue } # real interactive users only + $img = (Get-ItemProperty $pl.PSPath -Name ProfileImagePath -ErrorAction SilentlyContinue).ProfileImagePath + if (-not $img) { continue } + + $hiveKeyPath = "Registry::HKU\$sid" + $tempLoaded = $false + if (-not (Test-Path $hiveKeyPath)) { + $ntuser = Join-Path $img "NTUSER.DAT" + if (-not (Test-Path $ntuser)) { continue } + & reg load "HKU\$sid" $ntuser 2>&1 | Out-Null + if ($LASTEXITCODE -ne 0) { + Write-Log " Could not load hive for $sid (in use?) - skipped" -Level WARN + continue + } + $tempLoaded = $true + } + try { + $colorsKey = "$hiveKeyPath\Control Panel\Colors" + if (-not (Test-Path $colorsKey)) { New-Item -Path $colorsKey -Force -ErrorAction Stop | Out-Null } + Set-ItemProperty -Path $colorsKey -Name "Background" -Value "34 59 71" -Type String -Force -ErrorAction Stop + Write-Log " Background color set for $sid ($(Split-Path $img -Leaf))" -Level OK + } + catch { + Write-Log " Failed background color for $sid - $_" -Level WARN + } + finally { + if ($tempLoaded) { + [GC]::Collect(); [GC]::WaitForPendingFinalizers(); Start-Sleep -Milliseconds 300 + & reg unload "HKU\$sid" 2>&1 | Out-Null + } + } + } + # =================================================================== # KEYBOARD LAYOUTS - Czech primary, US secondary # =================================================================== diff --git a/web/data/descriptions.json b/web/data/descriptions.json index 87e5ec5..7174632 100644 --- a/web/data/descriptions.json +++ b/web/data/descriptions.json @@ -83,7 +83,7 @@ "registry-osname-hklm-software-backinfo": "Detects Windows build number and edition, writes OSName string to HKLM\\SOFTWARE\\BackInfo\\OSName (and WOW6432Node). BackInfo.ini references %OSName% to display the correct OS on the wallpaper.", "startup-shortcut-backinfo-exe": "Creates a shortcut at C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\BackInfo.lnk pointing to C:\\Program Files\\Backinfo\\BackInfo.exe. Ensures BackInfo starts for every user on logon.", "07-desktop-info-ps1-smazat-nahrazeno": "07-desktop-info.ps1 is superseded by this script. BackInfo.exe is the preferred approach - stable on Win10 and Win11, configurable via INI, already present in assets.", - "backinfo-pozadi-223b47": "BackInfo.ini sets a solid #223B47 background via BackgroundColor = 4668194. BackInfo uses a Windows COLORREF (0x00BBGGRR, i.e. BGR), so #223B47 = B*65536 + G*256 + R = 71*65536 + 59*256 + 34 = 4668194. The RGB value 2243399 (0x223B47) was read as a COLORREF, swapping red/blue, and rendered olive-brown (#473B22)." + "backinfo-pozadi-223b47": "BackInfo.ini sets a solid #223B47 background via BackgroundColor = 4668194. BackInfo uses a Windows COLORREF (0x00BBGGRR, i.e. BGR), so #223B47 = B*65536 + G*256 + R = 71*65536 + 59*256 + 34 = 4668194. The RGB value 2243399 (0x223B47) was read as a COLORREF, swapping red/blue, and rendered olive-brown (#473B22). BackInfo paints a centered bitmap, so the solid desktop background color (#223B47) is set in the Default hive, current user, HKU\\.DEFAULT and every existing profile - otherwise the area around a sub-screen bitmap shows a black border." } }, "07-desktop-info": { diff --git a/web/spec/index.html b/web/spec/index.html index 637c2de..4f0217d 100644 --- a/web/spec/index.html +++ b/web/spec/index.html @@ -709,6 +709,7 @@ BackInfo.exe v assets/Backinfo/ k dispoziciHotovo BackInfo auto-start pri kazdem logonu via Startup shortcutShortcut do ProgramData\StartUp vytvori 07-backinfo.ps1 Pozadi #223B47 (BackgroundColor = 4668194)BackInfo bere hodnotu jako COLORREF (0x00BBGGRR, BGR): B=71 G=59 R=34 = 4668194. Hodnota 2243399 (RGB) se cetla jako COLORREF, prohodila R/B a renderovala olivove hnedou (#473B22). + Desktopova barva pozadi #223B47 ve vsech profilechBackInfo dela vystredenou bitmapu; kdyz je mensi nez obrazovka, okolo prosvita Control Panel\Colors\Background. Nastavuje se v Default hive, aktualnim HKCU, HKU\.DEFAULT i v kazdem existujicim profilu – jinak byl okraj cerny.
BackInfo.ini konfiguruje: hostname (velky, centrovan), uzivatelske jmeno,