Skip to content

Commit

Permalink
fix(theme): more delay & fix thememru v2
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Apr 3, 2024
1 parent 484dd58 commit 1844cfe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
20 changes: 12 additions & 8 deletions src/playbook/Configuration/tweaks/qol/appearance/atlas-theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ description: Adds and sets the Atlas themes by default
actions:
# Apply theme file
- !cmd:
command: 'start ms-settings:themes & ping 127.0.0.1 -n 6 > nul & start "" "%windir%\Resources\Themes\atlas-v0.4.x-dark.theme"'
command: 'start ms-settings:themes & ping 127.0.0.1 -n 6 > nul & start "" "Themes\atlas-v0.4.x-dark.theme"'
exeDir: true
wait: true
runas: currentUserElevated
- !run: {exe: 'ping', args: '127.0.0.1 -n 6'}

# For Windows 11, set recent theme selection
- !taskKill: {name: 'SystemSettings', ignoreErrors: true}
- !taskKill: {name: 'control', ignoreErrors: true}
- !taskKill: {name: 'explorer', ignoreErrors: true, builds: [ '>=22000' ]}
- !powerShell:
command: '.\AtlasModules\Scripts\newUsers.ps1 -ThemeMRU'
exeDir: true
wait: true
runas: currentUserElevated
builds: [ '>=22000' ]
- !run: {exe: 'explorer.exe', runas: 'currentUser', wait: false, builds: [ '>=22000' ]}

# Applies Atlas lockscreen background
# Also disables fun facts, tips, tricks, and more on lockscreen - only on Enterprise/Education
Expand Down Expand Up @@ -38,10 +49,3 @@ actions:
value: 'ThemeFile'
data: '%windir%\Resources\Themes\atlas-v0.4.x-dark.theme'
type: REG_SZ

# For Windows 11, set recent theme selection
- !powerShell:
command: '.\AtlasModules\Scripts\newUsers.ps1 -ThemeMRU'
exeDir: true
wait: true
builds: [ '>=22000' ]
12 changes: 6 additions & 6 deletions src/playbook/Executables/AtlasModules/Scripts/newUsers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ param (
[switch]$ThemeMRU
)

$windir = [Environment]::GetFolderPath('Windows')
$atlasDesktop = "$windir\AtlasDesktop"
$atlasModules = "$windir\AtlasModules"

function ThemeMRU {
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" -Name "ThemeMRU" -Value "$((@(
"atlas-v0.4.x-dark.theme",
Expand All @@ -10,16 +14,12 @@ function ThemeMRU {
"atlas-v0.3.x-light.theme",
"dark.theme",
"aero.theme"
) | % { "$windir\resources\Themes\$_" }) -join ';');" -PropertyType String -Force | Out-Null
) | ForEach-Object { "$windir\resources\Themes\$_" }) -join ';');" -PropertyType String -Force
}
if ($ThemeMRU) { ThemeMRU; exit }

$title = 'Preparing Atlas user settings...'

$windir = [Environment]::GetFolderPath('Windows')
$atlasDesktop = "$windir\AtlasDesktop"
$atlasModules = "$windir\AtlasModules"

if (!(Test-Path $atlasDesktop) -or !(Test-Path $atlasModules)) {
Write-Host "Atlas was about to configure user settings, but its files weren't found. :(" -ForegroundColor Red
$null = Read-Host "Press Enter to exit"
Expand All @@ -37,7 +37,7 @@ if ([System.Environment]::OSVersion.Version.Build -ge 22000) {
reg import "$atlasDesktop\4. Interface Tweaks\File Explorer Customization\Gallery\Disable Gallery (default).reg" *>$null

# Set ThemeMRU (recent themes)
ThemeMRU
ThemeMRU | Out-Null
}

# Set lockscreen wallpaper
Expand Down

0 comments on commit 1844cfe

Please sign in to comment.