/
Settings.ps1
549 lines (495 loc) · 20.7 KB
/
Settings.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# https://docs.microsoft.com/en-us/windows/terminal/
# https://github.com/microsoft/terminal/issues/1555#issuecomment-505157311
if ($psISE)
{
exit
}
# Get the latest PSReadLine version number
# ((Invoke-WebRequest -Uri "https://api.github.com/repos/PowerShell/PSReadLine/releases" -UseBasicParsing | ConvertFrom-Json) | Where-Object -FilterScript {$_.prerelease -eq $false})[0].tag_name.Replace("v","")
$LatestRelease = ((Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/PSReadLine/releases") | Where-Object -FilterScript {$_.prerelease -eq $false}).tag_name.Replace("v","")[0]
$CurrentVersion = (Get-Module -Name PSReadline).Version.ToString()
if ($null -ne (Get-Module -Name PSReadline))
{
if ($CurrentVersion -ne $LatestRelease)
{
# Intalling the latest PSReadLine
# https://github.com/PowerShell/PSReadLine/releases
if (-not (Get-Package -Name NuGet -Force -ErrorAction Ignore))
{
Install-Package -Name NuGet -Force
}
Install-Module -Name PSReadLine -RequiredVersion $LatestRelease -Force
# Removing the old PSReadLine
$PSReadLine = @{
ModuleName = "PSReadLine"
ModuleVersion = $CurrentVersion
}
Remove-Module -FullyQualifiedName $PSReadLine -Force
Get-InstalledModule -Name PSReadline -AllVersions | Where-Object -FilterScript {$_.Version -eq $CurrentVersion} | Uninstall-Module -Force
Remove-Item -Path $env:ProgramFiles\WindowsPowerShell\Modules\PSReadline\$CurrentVersion -Recurse -Force -ErrorAction Ignore
Get-InstalledModule -Name PSReadline -AllVersions
Write-Verbose -Message "Restart the session" -Verbose
}
}
else
{
# Intalling the latest PSReadLine
# https://github.com/PowerShell/PSReadLine/releases
if (-not (Get-Package -Name NuGet -Force -ErrorAction Ignore))
{
Install-Package -Name NuGet -Force
}
Install-Module -Name PSReadLine -RequiredVersion $LatestRelease -Force
}
# Downloading Windows95.gif
# https://github.com/farag2/Utilities/tree/master/Windows%20Terminal
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if (-not (Test-Path -Path "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\Windows95.gif"))
{
$Parameters = @{
Uri = "https://github.com/farag2/Utilities/raw/master/Windows%20Terminal/Windows95.gif"
OutFile = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\RoamingState\Windows95.gif"
Verbose = [switch]::Present
}
Invoke-WebRequest @Parameters
}
if (Test-Path -Path "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json")
{
$settings = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
}
else
{
Start-Process -FilePath wt -Wait
exit
}
# Removing all comments to parse JSON file
if (Get-Content -Path $settings | Select-String -Pattern "//" -SimpleMatch)
{
Set-Content -Path $settings -Value (Get-Content -Path $settings | Select-String -Pattern "//" -NotMatch) -Force
}
# Deleting all blank lines from JSON file
(Get-Content -Path $settings) | Where-Object -FilterScript {$_.Trim(" `t")} | Set-Content -Path $settings -Force
try
{
$Terminal = Get-Content -Path $settings -Force | ConvertFrom-Json
}
catch [System.Exception]
{
Write-Verbose "JSON is not valid!" -Verbose
break
}
#region General
# Close tab
if (-not ($Terminal.actions | Where-Object -FilterScript {$_.command -eq "closeTab"} | Where-Object -FilterScript {$_.keys -eq "ctrl+w"}))
{
$closeTab = [PSCustomObject]@{
"command" = "closeTab"
"keys" = "ctrl+w"
}
$Terminal.actions += $closeTab
}
# New tab
if (-not ($Terminal.actions | Where-Object -FilterScript {$_.command -eq "newTab"} | Where-Object -FilterScript {$_.keys -eq "ctrl+t"}))
{
$newTab = [PSCustomObject]@{
"command" = "newTab"
"keys" = "ctrl+t"
}
$Terminal.actions += $newTab
}
# Find
if (-not ($Terminal.actions | Where-Object -FilterScript {$_.command -eq "find"} | Where-Object -FilterScript {$_.keys -eq "ctrl+f"}))
{
$find = [PSCustomObject]@{
"command" = "find"
"keys" = "ctrl+f"
}
$Terminal.actions += $find
}
# Split pane
if (-not ($Terminal.actions | Where-Object -FilterScript {$_.command.action -eq "splitPane"} | Where-Object -FilterScript {$_.command.split -eq "auto"} | Where-Object -FilterScript {$_.command.splitMode -eq "duplicate"}))
{
$split = [PSCustomObject]@{
"action" = "splitPane"
"split" = "auto"
"splitMode" = "duplicate"
}
$splitPane = [PSCustomObject]@{
"command" = $split
"keys" = "ctrl+shift+d"
}
$Terminal.actions += $splitPane
}
# No confirmation when closing all tabs
if ($Terminal.confirmCloseAllTabs)
{
$Terminal.confirmCloseAllTabs = $false
}
else
{
$Terminal | Add-Member -Name confirmCloseAllTabs -MemberType NoteProperty -Value $false -Force
}
# Show tabs in title bar
if ($Terminal.showTabsInTitlebar)
{
$Terminal.showTabsInTitlebar = $false
}
else
{
$Terminal | Add-Member -Name showTabsInTitlebar -MemberType NoteProperty -Value $false -Force
}
#endregion General
#region PowerShell
# Set Windows95.gif as a background image
if ($Terminal.profiles.list[0].backgroundImage)
{
$Terminal.profiles.list[0].backgroundImage = "ms-appdata:///roaming/Windows95.gif"
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name backgroundImage -MemberType NoteProperty -Value "ms-appdata:///roaming/Windows95.gif" -Force
}
# Background image alignment
if ($Terminal.profiles.list[0].backgroundImageAlignment)
{
$Terminal.profiles.list[0].backgroundImageAlignment = "bottomRight"
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name backgroundImageAlignment -MemberType NoteProperty -Value bottomRight -Force
}
# Background image opacity
$Value = 0.3
if ($Terminal.profiles.list[0].backgroundImageOpacity)
{
$Terminal.profiles.list[0].backgroundImageOpacity = $Value
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name backgroundImageOpacity -MemberType NoteProperty -Value 0.3 -Force
}
# Background image stretch mode
if ($Terminal.profiles.list[0].backgroundImageStretchMode)
{
$Terminal.profiles.list[0].backgroundImageStretchMode = "none"
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name backgroundImageStretchMode -MemberType NoteProperty -Value none -Force
}
# Starting directory
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
if ($Terminal.profiles.list[0].startingDirectory)
{
$Terminal.profiles.list[0].startingDirectory = $DownloadsFolder
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name startingDirectory -MemberType NoteProperty -Value $DownloadsFolder -Force
}
# Use acrylic
if ($Terminal.profiles.list[0].useAcrylic)
{
$Terminal.profiles.list[0].useAcrylic = $true
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name useAcrylic -MemberType NoteProperty -Value $true -Force
}
# Acrylic opacity
$Value = 0.75
if ($Terminal.profiles.list[0].acrylicOpacity)
{
$Terminal.profiles.list[0].acrylicOpacity = $Value
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name acrylicOpacity -MemberType NoteProperty -Value 0.75 -Force
}
# Set "Fira Code" as a default font
if ((New-Object -TypeName System.Drawing.Text.InstalledFontCollection).Families.Name -contains "Fira Code")
{
if ($Terminal.profiles.list[0].fontFace)
{
$Terminal.profiles.list[0].fontFace = "Fira Code"
}
else
{
$Terminal.profiles.list[0] | Add-Member -Name fontFace -MemberType NoteProperty -Value "Fira Code" -Force
}
}
#endregion PowerShell
#region CMD
# Set Windows95.gif as a background image
if ($Terminal.profiles.list[1].backgroundImage)
{
$Terminal.profiles.list[1].backgroundImage = "ms-appdata:///roaming/Windows95.gif"
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name backgroundImage -MemberType NoteProperty -Value "ms-appdata:///roaming/Windows95.gif" -Force
}
# Background image alignment
if ($Terminal.profiles.list[1].backgroundImageAlignment)
{
$Terminal.profiles.list[1].backgroundImageAlignment = "bottomRight"
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name backgroundImageAlignment -MemberType NoteProperty -Value bottomRight -Force
}
# Background image opacity
$Value = 0.3
if ($Terminal.profiles.list[1].backgroundImageOpacity)
{
$Terminal.profiles.list[1].backgroundImageOpacity = $Value
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name backgroundImageOpacity -MemberType NoteProperty -Value 0.3 -Force
}
# Background image stretch mode
if ($Terminal.profiles.list[1].backgroundImageStretchMode)
{
$Terminal.profiles.list[1].backgroundImageStretchMode = "none"
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name backgroundImageStretchMode -MemberType NoteProperty -Value none -Force
}
# Starting directory
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
if ($Terminal.profiles.list[1].startingDirectory)
{
$Terminal.profiles.list[1].startingDirectory = $DownloadsFolder
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name startingDirectory -MemberType NoteProperty -Value $DownloadsFolder -Force
}
# Use acrylic
if ($Terminal.profiles.list[1].useAcrylic)
{
$Terminal.profiles.list[1].useAcrylic = $true
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name useAcrylic -MemberType NoteProperty -Value $true -Force
}
# Acrylic opacity
$Value = 0.75
if ($Terminal.profiles.list[1].acrylicOpacity)
{
$Terminal.profiles.list[1].acrylicOpacity = $Value
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name acrylicOpacity -MemberType NoteProperty -Value 0.75 -Force
}
# Set "Fira Code" as a default font
if ((New-Object -TypeName System.Drawing.Text.InstalledFontCollection).Families.Name -contains "Fira Code")
{
if ($Terminal.profiles.list[1].fontFace)
{
$Terminal.profiles.list[1].fontFace = "Fira Code"
}
else
{
$Terminal.profiles.list[1] | Add-Member -Name fontFace -MemberType NoteProperty -Value "Fira Code" -Force
}
}
#endregion CMD
#region Azure
# Hide
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{b453ae62-4e3d-5e58-b989-0a998ec441b8}"}).hidden)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{b453ae62-4e3d-5e58-b989-0a998ec441b8}"}).hidden = $true
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{b453ae62-4e3d-5e58-b989-0a998ec441b8}"} | Add-Member -MemberType NoteProperty -Name hidden -Value $true -Force
}
#endregion Azure
#region Powershell Core
if (Test-Path -Path "$env:ProgramFiles\PowerShell\7")
{
# Background image stretch mode
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).namet)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).name = "PowerShell 7"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name name -Value "PowerShell 7" -Force
}
# Background image stretch mode
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImageAlignment)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImageAlignment = "bottomRight"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name backgroundImageAlignment -Value bottomRight -Force
}
# Background image opacity
$Value = 0.3
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImageOpacity)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImageOpacity = $Value
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name backgroundImageOpacity -Value 0.3 -Force
}
# Background image stretch mode
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImageStretchMode)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImageStretchMode = "none"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name backgroundImageStretchMode -Value none -Force
}
# Starting directory
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).startingDirectory)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).startingDirectory = $DownloadsFolder
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name startingDirectory -Value $DownloadsFolder -Force
}
# Use acrylic
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).useAcrylic)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).useAcrylic = $true
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name useAcrylic -Value $true -Force
}
# Acrylic opacity
$Value = 0.75
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).acrylicOpacity)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).acrylicOpacity = $Value
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name acrylicOpacity -Value 0.75 -Force
}
# Set Windows95.gif as a background image
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImage)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).backgroundImage = "ms-appdata:///roaming/Windows95.gif"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name backgroundImage -Value "ms-appdata:///roaming/Windows95.gif" -Force
}
# Set "Fira Code" as a default font
if ((New-Object -TypeName System.Drawing.Text.InstalledFontCollection).Families.Name -contains "Fira Code")
{
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).fontFace)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).fontFace = "Fira Code"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -Name fontFace -MemberType NoteProperty -Value "Fira Code" -Force
}
}
# Set the icon that displays within the tab, dropdown menu, jumplist, and tab switcher
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).icon)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"}).icon = "🏆"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{574e775e-4f2a-5b96-ac1e-a2962a402336}"} | Add-Member -MemberType NoteProperty -Name icon -Value "🏆" -Force
}
}
if (Test-Path -Path "$env:ProgramFiles\PowerShell\7-preview")
{
# Background image stretch mode
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImageAlignment)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImageAlignment = "bottomRight"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name backgroundImageAlignment -Value bottomRight -Force
}
# Background image opacity
$Value = 0.3
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImageOpacity)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImageOpacity = $Value
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name backgroundImageOpacity -Value 0.3 -Force
}
# Background image stretch mode
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImageStretchMode)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImageStretchMode = "none"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name backgroundImageStretchMode -Value none -Force
}
# Starting directory
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).startingDirectory)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).startingDirectory = $DownloadsFolder
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name startingDirectory -Value $DownloadsFolder -Force
}
# Use acrylic
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).useAcrylic)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).useAcrylic = $true
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name useAcrylic -Value $true -Force
}
# Acrylic opacity
$Value = 0.75
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).acrylicOpacity)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).acrylicOpacity = $Value
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name acrylicOpacity -Value 0.75 -Force
}
# Set Windows95.gif as a background image
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImage)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).backgroundImage = "ms-appdata:///roaming/Windows95.gif"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -MemberType NoteProperty -Name backgroundImage -Value "ms-appdata:///roaming/Windows95.gif" -Force
}
# Set "Fira Code" as a default font
if ((New-Object -TypeName System.Drawing.Text.InstalledFontCollection).Families.Name -contains "Fira Code")
{
if (($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).fontFace)
{
($Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"}).fontFace = "Fira Code"
}
else
{
$Terminal.profiles.list | Where-Object -FilterScript {$_.guid -eq "{a3a2e83a-884a-5379-baa8-16f193a13b21}"} | Add-Member -Name fontFace -MemberType NoteProperty -Value "Fira Code" -Force
}
}
}
#endregion Powershell Core
ConvertTo-Json -InputObject $Terminal -Depth 4 | Set-Content -Path $settings -Force