-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSetup.ps1
594 lines (532 loc) · 27.8 KB
/
Setup.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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
#requires -Version 7
#requires -RunAsAdministrator
$VerbosePreference = "SilentlyContinue"
########################################################################################################################
### HELPER FUNCTIONS ###
########################################################################################################################
function Add-ScoopBucket {
param ([string]$BucketName)
$scoopDir = (Get-Command scoop.ps1 -ErrorAction SilentlyContinue).Source | Split-Path | Split-Path
if (!(Test-Path "$scoopDir\buckets\$BucketName" -PathType Container)) {
scoop bucket add $BucketName
}
}
function Install-ScoopApp {
param ([string]$Package, [array]$AdditionalArgs)
if (!(scoop info $Package).Installed) {
if ($AdditionalArgs.Count -ge 1) {
$AdditionalArgs = $AdditionalArgs -join ' '
Invoke-Expression "scoop install $Package $AdditionalArgs"
} else { Invoke-Expression "scoop install $Package" }
}
}
function Install-WinGetApp {
param ([string]$PackageID, [array]$AdditionalArgs, [string]$Source)
winget list --exact -q $PackageID | Out-Null
if (!$?) {
$wingetCmd = "winget install $PackageID"
if ($AdditionalArgs.Count -ge 1) {
$AdditionalArgs = $AdditionalArgs -join ' '
$wingetCmd += " $AdditionalArgs"
}
if ($Source -eq "msstore") { $wingetCmd += " --source msstore" }
else { $wingetCmd += " --source winget" }
Invoke-Expression "$wingetCmd"
}
}
function Install-ChocoApp {
param ([string]$Package, [array]$AdditionalArgs)
$chocoList = choco list $Package
if ($chocoList -like "0 packages installed.") {
if ($AdditionalArgs.Count -ge 1) {
$AdditionalArgs = $AdditionalArgs -join ' '
Invoke-Expression "choco install $Package $AdditionArgs"
} else { Invoke-Expression "choco install $Package" }
}
}
function Install-PowerShellModule {
param ([string]$Module, [array]$AdditionalArgs)
if (!(Get-InstalledModule -Name $Module -ErrorAction SilentlyContinue)) {
if ($AdditionalArgs.Count -ge 1) {
$AdditionalArgs = $AdditionalArgs -join ' '
Invoke-Expression "Install-Module $Module $AdditionalArgs"
} else { Invoke-Expression "Install-Module $Module" }
}
}
function Install-AppFromGitHub {
param ([string]$RepoName, [string]$FileName)
$release = "https://api.github.com/repos/$RepoName/releases"
$tag = (Invoke-WebRequest $release | ConvertFrom-Json)[0].tag_name
$downloadUrl = "https://github.com/$RepoName/releases/download/$tag/$FileName"
$downloadPath = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
$downloadFile = "$downloadPath\$FileName"
(New-Object System.Net.Client).DownloadFile($downloadUrl, $downloadFile)
switch ($FileName.Split('.') | Select-Object -Last 1) {
"exe" {
Start-Process -FilePath "$downloadFile" -Wait
}
"msi" {
Start-Process -FilePath "$downloadFile" -Wait
}
"zip" {
$dest = "$downloadPath\$($FileName.Split('.'))"
Expand-Archive -Path "$downloadFile" -DestinationPath "$dest"
}
"7z" {
7z x -o"$downloadPath" -y "$downloadFile" | Out-Null
}
Default { break }
}
Remove-Item "$downloadFile" -Force -Recurse -ErrorAction SilentlyContinue
}
function Install-OnlineFile {
param ([string]$OutputDir, [string]$Url)
Invoke-WebRequest -Uri $Url -OutFile $OutputDir
}
function Refresh ([int]$Time) {
if (Get-Command choco -ErrorAction SilentlyContinue) {
switch -regex ($Time.ToString()) {
'1(1|2|3)$' { $suffix = 'th'; break }
'.?1$' { $suffix = 'st'; break }
'.?2$' { $suffix = 'nd'; break }
'.?3$' { $suffix = 'rd'; break }
default { $suffix = 'th'; break }
}
if (!(Get-Module -ListAvailable -Name "chocoProfile" -ErrorAction SilentlyContinue)) {
$chocoModule = "C:\ProgramData\chocolatey\helpers\chocolateyProfile.psm1"
if (Test-Path $chocoModule -PathType Leaf) {
Import-Module $chocoModule
}
}
Write-Verbose -Message "Refreshing environment variables from registry ($Time$suffix attempt)"
refreshenv | Out-Null
}
}
function Write-LockFile {
param (
[ValidateSet('winget', 'choco', 'scoop', 'modules')]
[Alias('s', 'p')][string]$PackageSource,
[Alias('f')][string]$FileName,
[Alias('o')][string]$OutputPath = "$($(Get-Location).Path)"
)
$dest = "$OutputPath\$FileName"
switch ($PackageSource) {
"winget" {
if (!(Get-Command winget -ErrorAction SilentlyContinue)) { return }
winget export -o $dest | Out-Null
if ($?) {
Write-Host "Packages installed by WinGet are exported at " -NoNewline -ForegroundColor Green
Write-Host "$dest" -ForegroundColor Yellow
}
Start-Sleep -Seconds 1
}
"choco" {
if (!(Get-Command choco -ErrorAction SilentlyContinue)) { return }
choco export $dest | Out-Null
if ($?) {
Write-Host "Packages installed by Chocolatey are exported at " -NoNewline -ForegroundColor Green
Write-Host "$dest" -ForegroundColor Yellow
}
Start-Sleep -Seconds 1
}
"scoop" {
if (!(Get-Command scoop -ErrorAction SilentlyContinue)) { return }
scoop export > $dest
if ($?) {
Write-Host "Packages installed by Scoop are exported at " -NoNewline -ForegroundColor Green
Write-Host "$dest" -ForegroundColor Yellow
}
Start-Sleep -Seconds 1
}
"modules" {
Get-InstalledModule | Select-Object -Property Name, Version | ConvertTo-Json -Depth 100 | Out-File $dest
if ($?) {
Write-Host "PowerShell Modules installed are exported at " -NoNewline -ForegroundColor Green
Write-Host "$dest" -ForegroundColor Yellow
}
Start-Sleep -Seconds 1
}
}
}
########################################################################################################################
### MAIN SCRIPT ###
########################################################################################################################
# set current working directory location
$currentLocation = "$($(Get-Location).Path)"
Set-Location $PSScriptRoot
[System.Environment]::CurrentDirectory = $PSScriptRoot
$i = 1
########################################################################################################################
### NERD FONTS ###
########################################################################################################################
# install nerd fonts
''
Write-Verbose "Installing Nerd Fonts"
Write-Host "The following fonts are highly recommended: " -ForegroundColor Green
Write-Host "(Please skip this step if you already installed Nerd Fonts)" -ForegroundColor DarkGray
Write-Output " ● Cascadia Code Nerd Font"
Write-Output " ● FantasqueSansM Nerd Font"
Write-Output " ● FiraCode Nerd Font"
Write-Output " ● JetBrainsMono Nerd Font"
''
$installNerdFonts = $(Write-Host "[RECOMMENDED] Install NerdFont now? (y/N): " -NoNewline -ForegroundColor Magenta; Read-Host)
if ($installNerdFonts.ToUpper() -eq 'Y') {
& ([scriptblock]::Create((Invoke-WebRequest 'https://to.loredo.me/Install-NerdFont.ps1'))) -Scope AllUsers -Confirm:$False
Refresh ($i++)
} else { Write-Host "Skipped installing Nerd Fonts..." -ForegroundColor DarkGray; '' }
########################################################################################################################
### WINGET PACKAGES ###
########################################################################################################################
# Retrieve information from json file
$json = Get-Content "$PSScriptRoot\appList.json" -Raw | ConvertFrom-Json
# Winget Packages
$wingetItem = $json.package_source.winget
$wingetPkgs = $wingetItem.packages
$wingetArgs = $wingetItem.additional_args
$wingetInstall = $wingetItem.auto_install
if ($wingetInstall -eq $True) {
if (!(Get-Command winget -ErrorAction SilentlyContinue)) {
# https://github.com/asheroto/winget-install
Write-Verbose -Message "Installing winget-cli"
&([ScriptBlock]::Create((Invoke-RestMethod asheroto.com/winget))) -Force
}
# Configure winget settings for better performance
$settingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json"
$settingsJson = @'
{
"$schema": "https://aka.ms/winget-settings.schema.json",
// For documentation on these settings, see: https://aka.ms/winget-settings
// "source": {
// "autoUpdateIntervalInMinutes": 5
// },
"visual": {
"enableSixels": true,
"progressBar": "rainbow"
},
"telemetry": {
"disable": true
},
"experimentalFeatures": {
"configuration03": true,
"configureExport": true,
"configureSelfElevate": true,
"experimentalCMD": true
},
"network": {
"downloader": "wininet"
}
}
'@
$settingsJson | Out-File $settingsPath -Encoding utf8
# Download packages
foreach ($pkg in $wingetPkgs) {
if ($null -ne $pkg.source) {
Install-WinGetApp -PackageID "$($pkg.id)" -AdditionalArgs $wingetArgs -Source "$($pkg.source)"
} else {
Install-WinGetApp -PackageID "$($pkg.id)" -AdditionalArgs $wingetArgs
}
}
Write-LockFile -PackageSource winget -FileName wingetfile.json -OutputPath $PSScriptRoot
Refresh ($i++)
}
########################################################################################################################
### CHOCOLATEY PACKAGES ###
########################################################################################################################
# Chocolatey Packages
$chocoItem = $json.package_source.choco
$chocoPkgs = $chocoItem.packages
$chocoArgs = $chocoItem.additional_args
$chocoInstall = $chocoItem.auto_install
if ($chocoInstall -eq $True) {
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
Write-Verbose -Message "Installing chocolatey"
if ((Get-ExecutionPolicy) -eq "Restricted") { Set-ExecutionPolicy AllSigned }
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
foreach ($pkg in $chocoPkgs) { Install-ChocoApp -Package $pkg -AdditionalArgs $chocoArgs }
Write-LockFile -PackageSource choco -FileName chocolatey.config -OutputPath $PSScriptRoot
Refresh ($i++)
}
########################################################################################################################
### SCOOP PACKAGES ###
########################################################################################################################
# Scoop Packages
$scoopItem = $json.package_source.scoop
$scoopBuckets = $scoopItem.buckets
$scoopPkgs = $scoopItem.packages
$scoopArgs = $scoopItem.additional_args
$scoopInstall = $scoopItem.auto_install
if ($scoopInstall -eq $True) {
if (!(Get-Command scoop -ErrorAction SilentlyContinue)) {
# follow https://github.com/ScoopInstaller/Install#for-admin
Write-Verbose -Message "Installing scoop"
Invoke-Expression "& {$(Invoke-RestMethod get.scoop.sh)} -RunAsAdmin"
}
if (!(Get-Command aria2c -ErrorAction SilentlyContinue)) { scoop install aria2 }
if (!($(scoop config aria2-enabled) -eq $True)) { scoop config aria2-enabled true }
if (!($(scoop config aria2-warning-enabled) -eq $False)) { scoop config aria2-warning-enabled false }
if (!(Get-ScheduledTaskInfo -TaskName "Aria2RPC" -ErrorAction Ignore)) {
$scoopDir = (Get-Command scoop.ps1 -ErrorAction SilentlyContinue).Source | Split-Path | Split-Path
$Action = New-ScheduledTaskAction -Execute "$scoopDir\apps\aria2\current\aria2c.exe" -Argument "--enable-rpc --rpc-listen-all" -WorkingDirectory "$Env:USERPROFILE\Downloads"
$Trigger = New-ScheduledTaskTrigger -AtStartup
$Principal = New-ScheduledTaskPrincipal -UserID "$Env:USERDOMAIN\$Env:USERNAME" -LogonType S4U
$Settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit 0 -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName "Aria2RPC" -Action $Action -Trigger $Trigger -Principal $Principal -Settings $Settings
}
foreach ($bucket in $scoopBuckets) { Add-ScoopBucket -BucketName $bucket }
foreach ($pkg in $scoopPkgs) { Install-ScoopApp -Package $pkg -AdditionalArgs $scoopArgs }
Write-LockFile -PackageSource scoop -FileName scoopfile.json -OutputPath $PSScriptRoot
Refresh ($i++)
}
########################################################################################################################
### POWERSHELL MODULES ###
########################################################################################################################
# Powershell Modules
$moduleItem = $json.powershell_modules
$moduleList = $moduleItem.modules
$moduleArgs = $moduleItem.additional_args
$moduleInstall = $moduleItem.install
if ($moduleInstall -eq $True) {
foreach ($module in $moduleList) { Install-PowerShellModule -Module $module -AdditionalArgs $moduleArgs }
Write-LockFile -PackageSource modules -FileName modules.json -OutputPath $PSScriptRoot
Refresh ($i++)
}
########################################################################################################################
### GIT SETUP ###
########################################################################################################################
# Configure git
if (Get-Command git -ErrorAction SilentlyContinue) {
$gitUserName = (git config user.name)
$gitUserMail = (git config user.email)
if ($null -eq $gitUserName) { $gitUserName = $(Write-Host "Input your git name: " -NoNewline -ForegroundColor Magenta; Read-Host) }
if ($null -eq $gitUserMail) { $gitUserMail = $(Write-Host "Input your git email: " -NoNewline -ForegroundColor Magenta; Read-Host) }
git submodule update --init --recursive
}
if (Get-Command gh -ErrorAction SilentlyContinue) {
if (!(gh auth status)) { gh auth login }
}
########################################################################################################################
### SYMLINKS ###
########################################################################################################################
# symlinks
$symlinks = @{
$PROFILE.CurrentUserAllHosts = ".\Profile.ps1"
"$Env:APPDATA\bat" = ".\config\bat"
"$Env:APPDATA\Code\User\keybindings.json" = ".\vscode\keybindings.json"
"$Env:APPDATA\Code\User\settings.json" = ".\vscode\settings.json"
"$Env:LOCALAPPDATA\fastfetch" = ".\config\fastfetch"
"$Env:LOCALAPPDATA\lazygit" = ".\config\lazygit"
"$Env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" = ".\windows\settings.json"
"$HOME\.bash_profile" = ".\home\.bash_profile"
"$HOME\.bashrc" = ".\home\.bashrc"
"$HOME\.config\bash" = ".\config\bash"
"$HOME\.config\delta" = ".\config\delta"
"$HOME\.config\eza" = ".\config\eza"
"$HOME\.config\gh-dash" = ".\config\gh-dash"
"$HOME\.config\komorebi" = ".\config\komorebi"
"$HOME\.config\npm" = ".\config\npm"
"$HOME\.config\spotify-tui" = ".\config\spotify-tui"
"$HOME\.config\whkdrc" = ".\config\whkdrc"
"$HOME\.config\yasb" = ".\config\yasb"
"$HOME\.config\yazi" = ".\config\yazi"
"$HOME\.czrc" = ".\home\.czrc"
"$HOME\.gitconfig" = ".\home\.gitconfig"
"$HOME\.inputrc" = ".\home\.inputrc"
"$HOME\.wslconfig" = ".\home\.wslconfig"
}
# add symlinks
foreach ($symlink in $symlinks.GetEnumerator()) {
Write-Verbose -Message "Creating symlink for $(Resolve-Path $symlink.Value) --> $($symlink.Key)"
Get-Item -Path $symlink.Key -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
New-Item -ItemType SymbolicLink -Path $symlink.Key -Target (Resolve-Path $symlink.Value) -Force | Out-Null
}
Refresh ($i++)
# Set the right git name and email for the user after symlinking
if (Get-Command git -ErrorAction SilentlyContinue) {
git config --global unset user.name
git config --global user.name $gitUserName
git config --global unset user.email
git config --global user.email $gitUserMail
}
########################################################################################################################
### ENVIRONMENT VARIABLES ###
########################################################################################################################
# add environment variables
$envVar = $json.environment_variables
foreach ($env in $envVar) {
if (Get-Command $($env.command) -ErrorAction SilentlyContinue) {
if (!([System.Environment]::GetEnvironmentVariable("$($env.name)"))) {
Write-Verbose "Setting environment variable for: $($env.name) --> $($env.value)"
[System.Environment]::SetEnvironmentVariable("$($env.name)", "$($env.value)", "User")
if ($LASTEXITCODE -ne 0) { Write-Error -ErrorAction Stop "An error occurred while creating environment variable with value $($env.value)" }
}
}
}
Refresh ($i++)
########################################################################################################################
### SETUP NODEJS / INSTALL NVM (Node Version Manager) ###
########################################################################################################################
if (!(Get-Command nvm -ErrorAction SilentlyContinue)) {
$installNvm = $(Write-Host "Install NVM? (y/N) " -ForegroundColor Magenta -NoNewline; Read-Host)
if ($installNvm.ToUpper() -eq 'Y') {
Write-Verbose "Installing NVM from GitHub Repo"
Install-AppFromGitHub -RepoName "coreybutler/nvm-windows" -FileName "nvm-setup.exe"
}
Refresh ($i++)
}
if (Get-Command nvm -ErrorAction SilentlyContinue) {
if (!(Get-Command node -ErrorAction SilentlyContinue)) {
$whichNode = $(Write-Host "Install LTS (y) or latest (N) Node version? " -ForegroundColor Magenta -NoNewline; Read-Host)
if ($whichNode.ToUpper() -eq 'Y') { nvm install lts }
else { nvm install latest }
nvm use newest
npm install -g npm@latest >$null 2>&1
corepack prepare --activate pnpm@latest
corepack prepare --activate yarn@latest
corepack enable
}
if (!(Get-Command bun -ErrorAction SilentlyContinue)) {
$useBun = $(Write-Host "Install Bun? (y/N): " -ForegroundColor Magenta -NoNewline; Read-Host)
if ($useBun.ToUpper() -eq 'Y') {
if (Get-Command pnpm -ErrorAction SilentlyContinue) {
Write-Verbose "Installing 'bun' using 'pnpm'"
pnpm install -g bun
} else {
Write-Verbose "Installing 'bun' using 'npm'"
npm install --global bun
}
}
}
}
########################################################################################################################
### ADDONS / PLUGINS ###
########################################################################################################################
# plugins / extensions / addons
$pluginItems = $json.package_plugins
foreach ($plugin in $pluginItems) {
$p = [PSCustomObject]@{
CommandName = $plugin.command_name
InvokeCommand = $plugin.invoke_command
CheckCommand = $plugin.check_command
List = [array]$plugin.plugins
InstallOrNot = $plugin.install
}
if ($p.InstallOrNot -eq $True) {
if (Get-Command "$($p.CommandName)" -ErrorAction SilentlyContinue) {
foreach ($pkg in $($p.List)) {
if (!(Invoke-Expression "$($p.CheckCommand)" | Select-String "$pkg")) {
Write-Verbose "Executing: $($p.InvokeCommand) $pkg"
Invoke-Expression "$($p.InvokeCommand) $pkg"
}
}
}
}
}
Refresh ($i++)
########################################################################################################################
### VSCODE EXTENSIONS ###
########################################################################################################################
# VSCode Extensions
if (Get-Command code -ErrorAction SilentlyContinue) {
$extensionList = Get-Content "$PSScriptRoot\vscode\extensions.list"
foreach ($ext in $extensionList) {
if (!(code --list-extensions | Select-String "$ext")) {
Write-Verbose -Message "Installing VSCode Extension: $ext"
Invoke-Expression "code --install-extension $ext"
}
}
}
########################################################################################################################
### CATPPUCCIN THEMES ###
########################################################################################################################
# Catppuccin Themes
$catppuccinThemes = @('Frappe', 'Latte', 'Macchiato', 'Mocha')
# FLowlauncher themes
$flowLauncherDir = "$env:LOCALAPPDATA\FlowLauncher"
if (Test-Path "$flowLauncherDir" -PathType Container) {
$flowLauncherThemeDir = "$flowLauncherDir\Themes"
$catppuccinThemes | ForEach-Object {
if (!(Test-Path "$flowLauncherThemeDir\Catppuccin $_.xaml" -PathType Leaf)) {
Write-Verbose "Adding file: `"Catppuccin $_.xaml`" to $flowLauncherThemeDir."
Install-OnlineFile -OutputDir "$flowLauncherThemeDir" -Url "https://raw.githubusercontent.com/catppuccin/flow-launcher/refs/heads/main/themes/Catppuccin%20$_.xaml"
}
}
}
# add btop theme
# since we install btop by scoop, then the application folder would be in scoop directory
if (Get-Command btop -ErrorAction SilentlyContinue) {
$scoopDir = (Get-Command scoop.ps1).Source | Split-Path | Split-Path
$btopThemeDir = "$scoopDir\apps\btop\current\themes"
$catppuccinThemes = $catppuccinThemes.ToLower()
$catppuccinThemes | ForEach-Object {
if (!(Test-Path "$btopThemeDir\catppuccin_$_.theme" -PathType Leaf)) {
Write-Verbose "Adding file: catppuccin_$_.theme to $btopThemeDir."
Install-OnlineFile -OutputDir "$btopThemeDir" -Url "https://raw.githubusercontent.com/catppuccin/btop/refs/heads/main/themes/catppuccin_$_.theme"
}
}
}
########################################################################################################################
### START KOMOREBI + YASB ###
########################################################################################################################
# start komorebi
if (Get-Command komorebic -ErrorAction SilentlyContinue) {
if ((!(Get-Process -Name komorebi -ErrorAction SilentlyContinue)) -and (!(Get-Process -Name whkd -ErrorAction SilentlyContinue))) {
Write-Verbose "Starting Komorebi with WHKD"
Invoke-Expression "komorebic start --whkd"
}
}
# start yasb
if (Get-Command yasb -ErrorAction SilentlyContinue) {
if (!(Get-Process -Name yasb -ErrorAction SilentlyContinue)) {
# Ensure the correct path to `yasb.exe` file
$yasbPath = (Get-Command yasb -ErrorAction SilentlyContinue).Source
if (Test-Path -Path "$yasbPath") {
Write-Verbose "Starting YASB Status Bar"
Start-Process -FilePath $yasbPath -Wait
}
}
}
# yazi plugins
if (Get-Command ya -ErrorAction SilentlyContinue) {
Write-Verbose "Installing yazi plugins / themes"
ya pack -i >$null 2>&1
ya pack -u >$null 2>&1
}
# bat build theme
if (Get-Command bat -ErrorAction SilentlyContinue) {
Write-Verbose "Building bat theme"
bat cache --clear >$null 2>&1
bat cache --build >$null 2>&1
}
########################################################################################################################
### WINDOWS SUBSYSTEMS FOR LINUX ###
########################################################################################################################
if (!(Get-Command wsl -CommandType Application -ErrorAction Ignore)) {
Write-Verbose -Message "Installing Windows SubSystems for Linux..."
Start-Process -FilePath "PowerShell" -ArgumentList "wsl", "--install" -Verb RunAs -Wait -WindowStyle Hidden
}
########################################################################################################################
### END SCRIPT ###
########################################################################################################################
Set-Location $currentLocation
Start-Sleep -Seconds 5
''
Write-Host "┌────────────────────────────────────────────────────────────────────────────────┐" -ForegroundColor "Green"
Write-Host "│ │" -ForegroundColor "Green"
Write-Host "│ █████╗ ██╗ ██╗ ██████╗ ██████╗ ███╗ ██╗███████╗ ██╗ │" -ForegroundColor "Green"
Write-Host "│ ██╔══██╗██║ ██║ ██╔══██╗██╔═══██╗████╗ ██║██╔════╝ ██║ │" -ForegroundColor "Green"
Write-Host "│ ███████║██║ ██║ ██║ ██║██║ ██║██╔██╗ ██║█████╗ ██║ │" -ForegroundColor "Green"
Write-Host "│ ██╔══██║██║ ██║ ██║ ██║██║ ██║██║╚██╗██║██╔══╝ ╚═╝ │" -ForegroundColor "Green"
Write-Host "│ ██║ ██║███████╗███████╗ ██████╔╝╚██████╔╝██║ ╚████║███████╗ ██╗ │" -ForegroundColor "Green"
Write-Host "│ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ ╚═╝ │" -ForegroundColor "Green"
Write-Host "│ │" -ForegroundColor "Green"
Write-Host "└────────────────────────────────────────────────────────────────────────────────┘" -ForegroundColor "Green"
''
Write-Host "For more information, please visit: " -NoNewline
Write-Host "https://github.com/jacquindev/windots" -ForegroundColor Blue
Write-Host "- Submit an issue via: " -NoNewline -ForegroundColor DarkGray
Write-Host "https://github.com/jacquindev/windots/issues/new" -ForegroundColor Blue
Write-Host "- Contact me via email: " -NoNewline -ForegroundColor DarkGray
Write-Host "[email protected]" -ForegroundColor Blue