-
-
Notifications
You must be signed in to change notification settings - Fork 159
Expand file tree
/
Copy pathmerge-settings.ps1
More file actions
79 lines (61 loc) · 2.66 KB
/
merge-settings.ps1
File metadata and controls
79 lines (61 loc) · 2.66 KB
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
# Quick Islands Dark Settings Merger for Antigravity
# This script merges Islands Dark theme settings into Antigravity
param()
$ErrorActionPreference = "Stop"
Write-Host "Merging Islands Dark settings into Antigravity..." -ForegroundColor Cyan
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$antigravitySettingsPath = "$env:APPDATA\Antigravity\User\settings.json"
# Check if Antigravity settings exist
if (-not (Test-Path $antigravitySettingsPath)) {
Write-Host "Error: Antigravity settings not found at: $antigravitySettingsPath" -ForegroundColor Red
exit 1
}
# Backup current settings
$backupPath = "$antigravitySettingsPath.backup"
Copy-Item $antigravitySettingsPath $backupPath -Force
Write-Host "Backed up current settings to: $backupPath" -ForegroundColor Green
# Function to strip JSONC (comments and trailing commas)
function Strip-Jsonc {
param([string]$Text)
$Text = $Text -replace '//.*$', ''
$Text = $Text -replace '/\*[\s\S]*?\*/', ''
$Text = $Text -replace ',\s*([}\]])', '$1'
return $Text
}
# Read current Antigravity settings
$currentSettingsRaw = Get-Content $antigravitySettingsPath -Raw
$currentSettings = (Strip-Jsonc $currentSettingsRaw) | ConvertFrom-Json
# Read Islands Dark settings
$islandsSettingsRaw = Get-Content "$scriptDir\settings.json" -Raw
$islandsSettings = (Strip-Jsonc $islandsSettingsRaw) | ConvertFrom-Json
# Merge settings (Islands Dark takes precedence)
$mergedSettings = @{}
# Start with current settings
$currentSettings.PSObject.Properties | ForEach-Object {
$mergedSettings[$_.Name] = $_.Value
}
# Override/add Islands Dark settings
$islandsSettings.PSObject.Properties | ForEach-Object {
$mergedSettings[$_.Name] = $_.Value
}
# Deep merge custom-ui-style.stylesheet
$stylesheetKey = 'custom-ui-style.stylesheet'
if ($currentSettings.$stylesheetKey -and $islandsSettings.$stylesheetKey) {
$mergedStylesheet = @{}
$currentSettings.$stylesheetKey.PSObject.Properties | ForEach-Object {
$mergedStylesheet[$_.Name] = $_.Value
}
$islandsSettings.$stylesheetKey.PSObject.Properties | ForEach-Object {
$mergedStylesheet[$_.Name] = $_.Value
}
$mergedSettings[$stylesheetKey] = [PSCustomObject]$mergedStylesheet
}
# Write merged settings
[PSCustomObject]$mergedSettings | ConvertTo-Json -Depth 100 | Set-Content $antigravitySettingsPath
Write-Host "Settings merged successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host " 1. Restart Antigravity"
Write-Host " 2. Theme should be automatically applied"
Write-Host " 3. If you see warnings about corrupt installation, click 'Don't Show Again'"
Write-Host ""