Skip to content

Commit 746a8a0

Browse files
authored
Merge branch 'new-update' into new-update
2 parents 72fc3f7 + cb0a3d0 commit 746a8a0

28 files changed

+341
-227
lines changed

src/playbook/Configuration/atlas/start.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,8 @@ actions:
3232

3333
- !writeStatus: {status: 'Enabling DirectPlay'}
3434
- !run: {exe: 'DISM.exe', args: '/Online /Enable-Feature /FeatureName:"DirectPlay" /NoRestart /All', weight: 30}
35-
36-
- !writeStatus: {status: 'Disabling Internet Explorer', builds: [ '<22000' ]}
37-
- !run: {exe: 'DISM.exe', args: '/Online /Disable-Feature /FeatureName:"Internet-Explorer-Optional-amd64" /NoRestart', weight: 30, builds: [ '<22000' ]}
38-
39-
- !writeStatus: {status: 'Disabling Maths Recognizer', builds: [ '<22000' ]}
40-
- !run: {exe: 'DISM.exe', args: '/Online /Remove-Capability /CapabilityName:"MathRecognizer~~~~0.0.1.0" /NoRestart', weight: 30, builds: [ '<22000' ]}
41-
42-
- !writeStatus: {status: 'Disabling Steps Recorder'}
43-
- !run: {exe: 'DISM.exe', args: '/Online /Remove-Capability /CapabilityName:"App.StepsRecorder~~~~0.0.1.0" /NoRestart', weight: 30}
35+
36+
- !run: {exe: 'DISM.exe', args: '/Online /Remove-Capability /CapabilityName:"App.StepsRecorder~~~~0.0.1.0" /NoRestart', weight: 30, onUpgrade: false}
4437

4538
- !writeStatus: {status: 'Cleaning the component store'}
4639
- !run: {exe: 'DISM.exe', args: '/Online /Cleanup-Image /StartComponentCleanup', weight: 50}

src/playbook/Configuration/custom.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ actions:
88
oobe: false
99
wait: true
1010
- !writeStatus: { status: "Deleting old AtlasOS folders" }
11+
- !powerShell:
12+
command: '.\STOPFOLDERPROC.ps1'
13+
exeDir: true
14+
wait: true
15+
runas: currentUserElevated
1116
- !powerShell:
1217
command: |
1318
$windir = [Environment]::GetFolderPath('Windows')
@@ -30,7 +35,9 @@ actions:
3035
Copy-Item -Path $_ -Destination $windir -Force -Recurse
3136
if (!$?) { exit 2 }
3237
}
33-
Start-Process -FilePath "$windir\AtlasDesktop\6. Advanced Configuration\Process Explorer\Uninstall Process Explorer.cmd" -ArgumentList "/silent"
38+
if (winget list --name "Process Explorer") {
39+
Start-Process -FilePath "$windir\AtlasDesktop\6. Advanced Configuration\Process Explorer\Uninstall Process Explorer.cmd" -ArgumentList "/silent"
40+
}
3441
Copy-Item -Path 'Themes\*' -Destination """$windir\Resources\Themes""" -Force -Recurse
3542
weight: 10
3643
wait: true

src/playbook/Configuration/tweaks/misc/add-newUser-script.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@
22
title: Add newUsers.cmd script
33
description: Adds the newUsers.ps1 script to RunOnce, which applies any tweaks that are dynamically generated on new user creation
44
actions:
5-
- !powerShell:
6-
command: 'reg load HKU\AME_UserHive_Default C:\Users\Default\NTUSER.DAT'
7-
oobe: false
8-
wait: true
95
- !registryValue:
106
path: 'HKU\AME_UserHive_Default\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce'
117
value: 'RunScript'
128
data: |
13-
powershell -EP Bypass -NoP & """$([Environment]::GetFolderPath('Windows'))\AtlasModules\Scripts\newUsers.cmd"""
14-
type: REG_SZ
15-
- !powerShell:
16-
command: "reg unload \"HKU\\AME_UserHive_Default\""
17-
oobe: false
18-
wait: true
9+
powershell -EP Bypass -NoP & """$([Environment]::GetFolderPath('Windows'))\AtlasModules\Scripts\newUsers.ps1"""
10+
type: REG_SZ

src/playbook/Configuration/tweaks/networking/atlas-network-settings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Applies Atlas' Network Settings
33
description: Applies Atlas' optimised network settings
44
actions:
55
- !cmd:
6-
command: '"AtlasDesktop\8. Troubleshooting\Network\Reset Network to Atlas Default.cmd" /silent'
6+
command: '"AtlasDesktop\9. Troubleshooting\Network\Reset Network to Atlas Default.cmd" /silent'
77
exeDir: true
88
wait: true
99
runas: currentUserElevated

src/playbook/Configuration/tweaks/performance/disable-sysfetch.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ actions:
99
Set-ThemeMRU
1010
wait: true
1111
onUpgrade: true
12-
oobe: false
12+
oobe: true
1313
exeDir: true
1414
runas: currentUserElevated
1515

1616
- !powerShell:
1717
command: |
1818
.\AtlasModules\initPowerShell.ps1
19-
Set-Theme -Path """$([Environment]::GetFolderPath('Windows'))\Resources\Themes\atlas-v0.4.x-dark.theme"""
19+
Set-Theme -Path """$([Environment]::GetFolderPath('Windows'))\Resources\Themes\atlas-v0.5.x-dark.theme"""
2020
Set-ThemeMRU
2121
wait: true
2222
onUpgrade: false
@@ -56,9 +56,9 @@ actions:
5656

5757
# Set Atlas theme as default for new users
5858
- !registryValue:
59-
path: 'HKCU\Software\Policies\Microsoft\Windows\Personalization'
59+
path: 'HKU\AME_UserHive_Default\Software\Policies\Microsoft\Windows\Personalization'
6060
value: 'ThemeFile'
61-
data: '%windir%\Resources\Themes\atlas-v0.4.x-dark.theme'
61+
data: '%windir%\Resources\Themes\atlas-v0.5.x-dark.theme'
6262
type: REG_SZ
6363
onUpgrade: true
6464

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +0,0 @@
1-
$windir = [Environment]::GetFolderPath('Windows')
2-
3-
function Stop-ThemeProcesses {
4-
Get-Process 'SystemSettings', 'control' -EA 0 | Stop-Process -Force -EA 0
5-
}
6-
7-
function Set-Theme {
8-
param (
9-
[Parameter(Mandatory = $true)]
10-
[ValidateNotNullOrEmpty()]
11-
[string]$Path
12-
)
13-
14-
if (!((Get-Item $Path -EA 0).Extension -eq '.theme')) {
15-
throw "'$Path' is not a valid path to a theme file."
16-
}
17-
Stop-ThemeProcesses
18-
Start-Process -filepath $path ; timeout /t 3; taskkill /im "systemsettings.exe" /f
19-
Start-Sleep 10
20-
Stop-ThemeProcesses
21-
}
22-
23-
function Set-ThemeMRU {
24-
if ([System.Environment]::OSVersion.Version.Build -ge 22000) {
25-
Stop-ThemeProcesses
26-
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" -Name "ThemeMRU" -Value "$((@(
27-
"atlas-v0.4.x-dark.theme",
28-
"atlas-v0.4.x-light.theme",
29-
"atlas-v0.3.x-dark.theme",
30-
"atlas-v0.3.x-light.theme",
31-
"dark.theme",
32-
"aero.theme"
33-
) | ForEach-Object { "$windir\resources\Themes\$_" }) -join ';');" -Type String -Force
34-
}
35-
}
36-
37-
# Credit: https://superuser.com/a/1343640
38-
function Set-LockscreenImage {
39-
param (
40-
[ValidateNotNullOrEmpty()]
41-
[string]$Path = "$([Environment]::GetFolderPath('Windows'))\AtlasModules\Wallpapers\lockscreen.png"
42-
)
43-
44-
if (!(Test-Path $Path)) {
45-
throw "Path ('$Path') for lockscreen not found."
46-
}
47-
$newImagePath = [System.IO.Path]::GetTempPath() + (New-Guid).Guid + [System.IO.Path]::GetExtension($Path)
48-
Copy-Item $Path $newImagePath
49-
50-
# setup WinRT namespaces
51-
Add-Type -AssemblyName System.Runtime.WindowsRuntime
52-
[Windows.System.UserProfile.LockScreen, Windows.System.UserProfile, ContentType = WindowsRuntime] | Out-Null
53-
54-
# setup async
55-
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? {
56-
$_.Name -eq 'AsTask' -and
57-
$_.GetParameters().Count -eq 1 -and
58-
$_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1'
59-
})[0]
60-
Function Await($WinRtTask, $ResultType) {
61-
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
62-
$netTask = $asTask.Invoke($null, @($WinRtTask))
63-
$netTask.Wait(-1) | Out-Null
64-
$netTask.Result
65-
}
66-
Function AwaitAction($WinRtAction) {
67-
$asTask = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and !$_.IsGenericMethod })[0]
68-
$netTask = $asTask.Invoke($null, @($WinRtAction))
69-
$netTask.Wait(-1) | Out-Null
70-
}
71-
72-
# make image object
73-
[Windows.Storage.StorageFile, Windows.Storage, ContentType = WindowsRuntime] | Out-Null
74-
$image = Await ([Windows.Storage.StorageFile]::GetFileFromPathAsync($newImagePath)) ([Windows.Storage.StorageFile])
75-
76-
# execute
77-
AwaitAction ([Windows.System.UserProfile.LockScreen]::SetImageFileAsync($image))
78-
79-
# cleanup
80-
Remove-Item $newImagePath
81-
}
82-
83-
Export-ModuleMember -Function Set-Theme, Set-ThemeMRU, Set-LockscreenImage

src/playbook/Executables/AtlasModules/Scripts/Modules/Utils/Utils.psm1

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function Write-Title {
22
param (
3-
[Parameter(Mandatory=$true)]
3+
[Parameter(Mandatory = $true)]
44
[string]$Text
55
)
66

@@ -35,9 +35,9 @@ enum MsgButtons {
3535
}
3636
function Read-MessageBox {
3737
param (
38-
[Parameter(Mandatory=$true)]
38+
[Parameter(Mandatory = $true)]
3939
[string]$Title,
40-
[Parameter(Mandatory=$true)]
40+
[Parameter(Mandatory = $true)]
4141
[string]$Body,
4242
[MsgIcon]$Icon = 'Info',
4343
[MsgButtons]$Buttons = 'YesNo',
@@ -50,7 +50,7 @@ function Read-MessageBox {
5050
$value += [MsgButtons].GetEnumValues().IndexOf([MsgButtons]"$Buttons") # buttons
5151
if (!$NoTopmost) { $value += 4096 } # topmost
5252

53-
$result = (New-Object -ComObject "Wscript.Shell").Popup($Body,$Timeout,$Title,$value)
53+
$result = (New-Object -ComObject "Wscript.Shell").Popup($Body, $Timeout, $Title, $value)
5454
$results = @{
5555
1 = 'Ok'
5656
2 = 'Cancel'
@@ -63,9 +63,105 @@ function Read-MessageBox {
6363

6464
if ($result) {
6565
return $results.$result
66-
} else {
66+
}
67+
else {
6768
return 'None'
6869
}
6970
}
7071

71-
Export-ModuleMember -Function Write-Title, Read-Pause, Read-MessageBox
72+
function Stop-ProcessesUnderRoots {
73+
param([string[]]$RootsLower)
74+
75+
foreach ($proc in Get-Process -ErrorAction SilentlyContinue) {
76+
if (-not $proc.Path) { continue }
77+
78+
$procPath = try {
79+
([System.IO.Path]::GetFullPath($proc.Path)).ToLowerInvariant()
80+
}
81+
catch {
82+
continue
83+
}
84+
85+
foreach ($root in $RootsLower) {
86+
if ($procPath.StartsWith($root)) {
87+
try {
88+
Stop-Process -Id $proc.Id -Force -ErrorAction Stop
89+
Wait-Process -Id $proc.Id -ErrorAction SilentlyContinue -Timeout 5
90+
}
91+
catch {
92+
continue
93+
}
94+
95+
break
96+
}
97+
}
98+
}
99+
}
100+
101+
function Stop-TasksUnderRoots {
102+
param([string[]]$RootsLower)
103+
104+
try {
105+
Import-Module ScheduledTasks -ErrorAction SilentlyContinue | Out-Null
106+
}
107+
catch {
108+
# Module may not be available on older systems; continue with fallbacks.
109+
}
110+
111+
$tasks = @()
112+
try {
113+
$tasks = Get-ScheduledTask -ErrorAction Stop
114+
}
115+
catch {
116+
$tasks = @()
117+
}
118+
119+
foreach ($task in $tasks) {
120+
$matchesRoot = $false
121+
122+
foreach ($action in $task.Actions) {
123+
$execute = $null
124+
if ($action.PSObject.Properties.Match('Execute').Count) {
125+
$execute = $action.Execute
126+
}
127+
elseif ($action.PSObject.Properties.Match('Path').Count) {
128+
$execute = $action.Path
129+
}
130+
131+
if (-not $execute) { continue }
132+
133+
$executeLower = try {
134+
([System.IO.Path]::GetFullPath($execute)).ToLowerInvariant()
135+
}
136+
catch {
137+
$null
138+
}
139+
140+
if (-not $executeLower) { continue }
141+
142+
foreach ($root in $RootsLower) {
143+
if ($executeLower.StartsWith($root)) {
144+
$matchesRoot = $true
145+
break
146+
}
147+
}
148+
149+
if ($matchesRoot) { break }
150+
}
151+
152+
if (-not $matchesRoot) { continue }
153+
154+
try {
155+
Stop-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath -ErrorAction SilentlyContinue
156+
}
157+
catch {
158+
# Ignore and fall back to schtasks below.
159+
}
160+
}
161+
162+
foreach ($candidate in @('Force Timer Resolution', '\Force Timer Resolution')) {
163+
& schtasks.exe /End /TN $candidate 1>$null 2>$null
164+
}
165+
}
166+
167+
Export-ModuleMember -Function Write-Title, Read-Pause, Read-MessageBox, Stop-ProcessesUnderRoots, Stop-TasksUnderRoots

0 commit comments

Comments
 (0)