-
Notifications
You must be signed in to change notification settings - Fork 0
/
monaspace.json
98 lines (98 loc) · 6.23 KB
/
monaspace.json
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
{
"version": "1.101",
"description": "An innovative superfamily of fonts for code",
"homepage": "https://monaspace.githubnext.com",
"license": "OFL-1.1",
"url": "https://github.com/githubnext/monaspace/releases/download/v1.101/monaspace-v1.101.zip",
"hash": "7ff2317c7bdaed8e81dcbe1314e6ab12ad9641b7ddf921e996a227ff4ec7752f",
"extract_dir": "monaspace-v1.101/fonts/otf",
"installer": {
"script": [
"$currentBuildNumber = [int] (Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\").CurrentBuildNumber",
"$windows10Version1809BuildNumber = 17763",
"$isPerUserFontInstallationSupported = $currentBuildNumber -ge $windows10Version1809BuildNumber",
"if (!$isPerUserFontInstallationSupported -and !$global) {",
" scoop uninstall $app",
" Write-Host \"\"",
" Write-Host \"For Windows version before Windows 10 Version 1809 (OS Build 17763),\" -Foreground DarkRed",
" Write-Host \"Font can only be installed for all users.\" -Foreground DarkRed",
" Write-Host \"\"",
" Write-Host \"Please use following commands to install '$app' Font for all users.\" -Foreground DarkRed",
" Write-Host \"\"",
" Write-Host \" scoop install sudo\"",
" Write-Host \" sudo scoop install -g $app\"",
" Write-Host \"\"",
" exit 1",
"}",
"$fontInstallDir = if ($global) { \"$env:windir\\Fonts\" } else { \"$env:LOCALAPPDATA\\Microsoft\\Windows\\Fonts\" }",
"if (-not $global) {",
" # Ensure user font install directory exists and has correct permission settings",
" # See https://github.com/matthewjberger/scoop-nerd-fonts/issues/198#issuecomment-1488996737",
" New-Item $fontInstallDir -ItemType Directory -ErrorAction SilentlyContinue | Out-Null",
" $accessControlList = Get-Acl $fontInstallDir",
" $allApplicationPackagesAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule([System.Security.Principal.SecurityIdentifier]::new(\"S-1-15-2-1\"), \"ReadAndExecute\", \"ContainerInherit,ObjectInherit\", \"None\", \"Allow\")",
" $allRestrictedApplicationPackagesAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule([System.Security.Principal.SecurityIdentifier]::new(\"S-1-15-2-2\"), \"ReadAndExecute\", \"ContainerInherit,ObjectInherit\", \"None\", \"Allow\")",
" $accessControlList.SetAccessRule($allApplicationPackagesAccessRule)",
" $accessControlList.SetAccessRule($allRestrictedApplicationPackagesAccessRule)",
" Set-Acl -AclObject $accessControlList $fontInstallDir",
"}",
"$registryRoot = if ($global) { \"HKLM\" } else { \"HKCU\" }",
"$registryKey = \"${registryRoot}:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\"",
"Get-ChildItem $dir -Filter '*.otf' | ForEach-Object {",
" $value = if ($global) { $_.Name } else { \"$fontInstallDir\\$($_.Name)\" }",
" New-ItemProperty -Path $registryKey -Name $_.Name.Replace($_.Extension, ' (TrueType)') -Value $value -Force | Out-Null",
" Copy-Item $_.FullName -Destination $fontInstallDir",
"}"
]
},
"pre_uninstall": [
"$fontInstallDir = if ($global) { \"$env:windir\\Fonts\" } else { \"$env:LOCALAPPDATA\\Microsoft\\Windows\\Fonts\" }",
"Get-ChildItem $dir -Filter '*.otf' | ForEach-Object {",
" Get-ChildItem $fontInstallDir -Filter $_.Name | ForEach-Object {",
" try {",
" Rename-Item $_.FullName $_.FullName -ErrorVariable LockError -ErrorAction Stop",
" } catch {",
" Write-Host \"\"",
" Write-Host \" Error \" -Background DarkRed -Foreground White -NoNewline",
" Write-Host \"\"",
" Write-Host \" Cannot uninstall '$app' font.\" -Foreground DarkRed",
" Write-Host \"\"",
" Write-Host \" Reason \" -Background DarkCyan -Foreground White -NoNewline",
" Write-Host \"\"",
" Write-Host \" The '$app' font is currently being used by another application,\" -Foreground DarkCyan",
" Write-Host \" so it cannot be deleted.\" -Foreground DarkCyan",
" Write-Host \"\"",
" Write-Host \" Suggestion \" -Background Magenta -Foreground White -NoNewline",
" Write-Host \"\"",
" Write-Host \" Close all applications that are using '$app' font (e.g. vscode),\" -Foreground Magenta",
" Write-Host \" and then try again.\" -Foreground Magenta",
" Write-Host \"\"",
" exit 1",
" }",
" }",
"}"
],
"uninstaller": {
"script": [
"$fontInstallDir = if ($global) { \"$env:windir\\Fonts\" } else { \"$env:LOCALAPPDATA\\Microsoft\\Windows\\Fonts\" }",
"$registryRoot = if ($global) { \"HKLM\" } else { \"HKCU\" }",
"$registryKey = \"${registryRoot}:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts\"",
"Get-ChildItem $dir -Filter '*.otf' | ForEach-Object {",
" Remove-ItemProperty -Path $registryKey -Name $_.Name.Replace($_.Extension, ' (TrueType)') -Force -ErrorAction SilentlyContinue",
" Remove-Item \"$fontInstallDir\\$($_.Name)\" -Force -ErrorAction SilentlyContinue",
"}",
"if ($cmd -eq \"uninstall\") {",
" Write-Host \"The '$($app.Replace('-NF', ''))' Font family has been uninstalled and will not be present after restarting your computer.\" -Foreground Magenta",
"}"
]
},
"checkver": {
"github": "https://github.com/githubnext/monaspace"
},
"autoupdate": {
"url": "https://github.com/githubnext/monaspace/releases/download/v$version/monaspace-v$version.zip",
"hash": {
"mode": "download"
}
}
}