-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindowShade Responsive Installer.bat
841 lines (725 loc) · 52.6 KB
/
WindowShade Responsive Installer.bat
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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
powershell.exe "Get-ExecutionPolicy -Scope 'CurrentUser' | Out-File -FilePath '%TEMP%\executionpolicy.txt' -Force; Set-ExecutionPolicy -Scope 'CurrentUser' -ExecutionPolicy 'Unrestricted'; $script = Get-Content '%~dpnx0'; $script -notmatch 'supercalifragilisticexpialidocious' | Out-File -FilePath '%TEMP%\%~n0.ps1' -Force; Start-Process powershell.exe \"Set-Location -Path '%~dp0'; ^& '%TEMP%\%~n0.ps1' %1\" -verb RunAs" && exit
<#
////////////////////////////////////////////////////
// WindowShade Responsive Installer by Lulech23 //
////////////////////////////////////////////////////
Apply brightness-responsive Windows color calibration profiles with ease!
What's New:
* Initial release
Notes:
*
To-do:
*
#>
<#
INITIALIZATION
#>
# Version... obviously
$version = "1.0"
# Windows calibration profile path
$profile = ""
$path = "$env:WinDir\System32\spool\drivers\color"
# Step count
$steps = 0
$step = 0
<#
BUILT-IN PROFILES
#>
# [Convert]::ToBase64String([IO.File]::ReadAllBytes($FileName))
$builtin = @(
"Aya Neo v1.icz", "UEsDBBQAAAAIAO6A5VKN2g4WkgkAAKQnAAAFAAAAMC5pY2PtGQtwVFf1bP4JkFKgQKGhj4A0oMlu/iTS0GRTAjZLMRvys7+Xze7mwX6eb99mE6jaou3o0GnxQ0dtFa2o1Y4yFXSwKsNYfwhTW4odoZ1aEezU/iky1amD55773r73dl8227SAnclmdu99997zP/d8XgCu2R2SItEcASAcUZWujjahr39AKDwNhZAPV+BvmeiLyR7vmm4Y93PuGXCw8enKzOdsPyVD/pgPx3cAHLf5ZEUFyLkJn6sTqszmO3A+R0GmcL6bzYN8vp/NB/n8CJ3p7nLj/AX8Tg/SPO8VNh+kecHbbO7xulwAxXkAi76p0WWfvhgTfEiKySFxTJCVaEAK+YWEpA4nF4dFZSghKn7BF40EpGBcEVUpGhGGRFUUhvyKNOIfEgJKNCz4xJA0yHcB/JGNXsTfCzHogg5oAwGGQMInGUIgwhg+y6BAFAK4GgI/PidwpsKwzclhHBVcTdDIzvoQMkKwQYjjmoiQEq0xaPYk0syPexKM4DiEzwGiGCZ4EbFLMGiBfZ8+qn9UZaM7Ko8pUnBYFSp8y4Ual6tO8Eg+JRqLBlTBHVXkqK4tNAT6Hod+q5t8yjH3kLEW3Qqw8nGAXNVY840C7H8aYO42Y23JKYDSTQA/b/DFlRG+Rg46BypgFWxAuROwHXbBXvg9vOLIcSxw1Do8Dslxt2O343HHqZyCnOU563PUnAdzfpvzeu7C3LW5idzv5x7Pm57Xmjeatyfvpfyl+WL+rvy/FggFvoKHC14rbCi8o/Bw0fyiYNH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H/pulVeK9ZofMq2Pf17884ht57ev13+sC2fKfrW4K/O1MVzDth7j16UvQNrQEOaauI2QdGea8fawYsXsYPfiJL7bbrakNaPGX0wu0dBTbPhdC9r7SHG79PykcWQ+eL09gxrCHeTeEbNIbtokZ/7BpOW7/IKRLfagNbrv7t6Gr9jFy9Jx+4lzLJWyefflY/NncF7j0Vf43fj4jvsm/M5n42/Vatvw6SJJPFk1NEr0++K9c7AnV7pM/UKrKrMrPt0Cn7KeAb2ZtQTz0MiUg1auM8+m43P6Lv1KMKyvJF5uX7XkLYjWm/YYOrbJoolmxPmtWGtdrJCm7O2J8vTx4fJ9q18vccMk29mmlidEKY8ovczzPN9JMl7Vxn4qEqTEKuferUajcfsGoGvXzrOxtbR5aogd1Wge9nFqQo4Vo6XZ7FqynUSWSsC/F2/QG82ZboTLqLLvUwwaXK8HJGfHIa8F6ci4HGAcSATZl0+vRJYh57gpYqgn/wqQj4btEgqaZ2RQh4oUCyLpd/lcy3yvMP7e/afgzj9ZydEGFJ51AX5acHQ1v9nXZCLO6uljSqtle53kPo/9m5m7MjRDGvRm/T3j21wK9KxWi1TkxOjomeV8eM9PwvwP1BLAQIUABQAAAAIAO6A5VKN2g4WkgkAAKQnAAAFAAAAAAAAAAAAAAAAAAAAAAAwLmljY1BLAQIUABQAAAAIAK145VIrptpsmQkAAKQnAAAHAAAAAAAAAAAAAAAAALUJAAAxMDAuaWNjUEsBAhQAFAAAAAgALX/lUiFLeLWdCQAApCcAAAYAAAAAAAAAAAAAAAAAcxMAADI1LmljY1BLAQIUABQAAAAIAH165VK8ILEZngkAAKQnAAAGAAAAAAAAAAAAAAAAADQdAAA1MC5pY2NQSwECFAAUAAAACABHeOVSihZpFY8JAACkJwAABgAAAAAAAAAAAAAAAAD2JgAANzUuaWNjUEsFBgAAAAAFAAUABAEAAKkwAAAAAA=="
)
<#
SHOW VERSION
#>
# Ooo, shiny!
Write-Host "`n " -BackgroundColor Blue -NoNewline
Write-Host "`n WindowShade Responsive Installer [v$version] by Lulech23 " -NoNewline -BackgroundColor Blue -ForegroundColor White
Write-Host "`n " -BackgroundColor Blue
# About
Write-Host "`nThis script will replace the current display calibration with a responsive"
Write-Host "profile selected from the menu below. Responsive profiles are packages comprised"
Write-Host "of unique color and gamma settings for different brightness levels."
Write-Host "`nYou may also run this script via command-line followed by the fully-qualified"
Write-Host "path to your *.icz package to install a new profile directly."
Write-Host "`nResponsive profiles require the use of an always-running background service." -ForegroundColor Cyan
Write-Host "The WindowShade service will override other calibrations while active." -ForegroundColor Cyan
# Current Profile
Write-Host "`nCalibration profile is currently set to: " -NoNewline
$profile = [string] (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles\").sRGB
$service = (Test-Path -Path "$env:AppData\WindowShade\wsservice.ps1")
if ($profile.length -gt 0) {
Write-Host "$profile" -ForegroundColor Yellow
Write-Host " * Display is calibrated" -ForegroundColor Gray
Write-Host " * Colors and gamma have been customized to suit your display" -ForegroundColor Gray
if ($service -eq $true) {
Write-Host " * WindowShade service is active. Profile will adapt to display brightness" -ForegroundColor Gray
} else {
Write-Host " * WindowShade service not found. Profile will not adapt to display brightness" -ForegroundColor Gray
}
} else {
Write-Host "Default" -ForegroundColor Magenta
Write-Host " * Display is not calibrated" -ForegroundColor Gray
Write-Host " * Colors and gamma may be inaccurate" -ForegroundColor Gray
}
$profile = ""
<#
MENU ACTIONS
#>
# User action
if ($args.count -eq 0) {
# Initialize tasks
$task = 0
$tasks = @(
"Install an external profile", # 1
"Install a built-in profile", # 2
"Uninstall current profile" # 3
"Create *.icz package", # 4
"Exit"
)
# Get user selection
Write-Host "`nPlease enter a number to choose an action:" -ForegroundColor Yellow
for ($t = 1; $t -le $tasks.count; $t++) {
Write-Host " ($t) $($tasks[$t - 1])"
}
Write-Host
while ($task -eq 0) {
$task = Read-Host "Select Action"
# Ensure valid input
if (($task -lt 1) -Or ($task -gt $tasks.count)) {
Write-Host "`nERROR: " -NoNewline -ForegroundColor Red
Write-Host "Invalid selection. Please try again."
Write-Host
$task = 0
}
}
} else {
# Install external profile via CLI, if supplied
Write-Host
$task = 1
}
<#
EXTERNAL PROFILE
#>
if ($task -eq 1) {
# Use supplied profile, if any
if ($args.count -gt 0) {
$profile = $args[0]
# Ensure valid selection
if (Test-Path -Path "$profile") {
$ext = (Get-Item "$profile").Extension
if ($ext -ne ".icz") {
$profile = ""
}
} else {
$profile = ""
}
if ($profile.length -eq 0) {
Write-Host "`nERROR: " -NoNewline -ForegroundColor Red
Write-Host "Requested profile not found. Please select and try again."
Write-Host
Write-Host "Press ENTER to continue"
}
}
# Prompt for external profile, if not supplied
if ($profile.length -eq 0) {
Add-Type -AssemblyName System.Windows.Forms
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = [Environment]::GetFolderPath("MyComputer")
Filter = "ICZ Package (*.icz)|*.icz"
Title = "Select a calibration profile package"
}
while ($profile.length -eq 0) {
$null = $FileBrowser.ShowDialog()
$profile = $FileBrowser.FileName
# Ensure valid selection
if ($profile.length -gt 0) {
if (!(Test-Path -Path "$profile")) {
$profile = ""
}
}
if ($profile.length -eq 0) {
Write-Host "`nERROR: " -NoNewline -ForegroundColor Red
Write-Host "Invalid selection. Please cancel or try again."
Write-Host
$profile = ""
$retry = Read-Host "Continue? (Y/N)"
# Exit if cancelled
if ($retry.Trim().ToUpper() -eq "N") {
$task = -1;
break;
}
}
}
if ($task -gt 0) {
Write-Host
}
}
# Copy selected profile to system
if ($profile.length -gt 0) {
# Ensure empty temp directory exists
if (!(Test-Path -Path "$env:Temp\WindowShade")) {
New-Item -ItemType directory -Path "$env:Temp\WindowShade"
} else {
Remove-Item "$env:Temp\WindowShade\*"
}
# Create temp files
Copy-Item "$profile" -Destination "$env:Temp\WindowShade\package.zip" -Force
$profile = (Get-Item $profile).BaseName
}
}
<#
BUILT-IN PROFILE
#>
if ($task -eq 2) {
# Get user selection
Write-Host "`nPlease enter a number to choose a profile:" -ForegroundColor Yellow
for ($b = 0; $b -lt $builtin.count; $b += 2) {
Write-Host " ($(($b/2) + 1)) $($builtin[$b])"
}
Write-Host
while ($profile.length -eq 0) {
$profile = Read-Host "Select Profile"
# Ensure valid input
if (($profile -lt 1) -Or ($profile -gt ($builtin.count/2))) {
Write-Host "`nERROR: " -NoNewline -ForegroundColor Red
Write-Host "Invalid selection. Please try again."
Write-Host
$profile = ""
}
}
Write-Host
# Ensure empty temp directory exists
if (!(Test-Path -Path "$env:Temp\WindowShade")) {
New-Item -ItemType directory -Path "$env:Temp\WindowShade"
} else {
Remove-Item "$env:Temp\WindowShade\*"
}
# Export selected profile
[IO.File]::WriteAllBytes("$env:Temp\WindowShade\package.zip", [Convert]::FromBase64String($builtin[$profile])) | Out-Null
$profile = $builtin[$profile - 1].Replace(".icz", "")
}
<#
INSTALL PROFILE
#>
if (($task -eq 1) -Or ($task -eq 2)) {
if (!(Test-Path -Path "$env:Temp\WindowShade\package.zip")) {
# Ensure copied profile exists
Write-Host "ERROR: " -NoNewline -ForegroundColor Red
Write-Host "Profile installation failed! Directory or file is inaccessible."
} else {
# Show setup Info
Write-Host "Setup will install: " -NoNewline -ForegroundColor Yellow
Write-Host $profile
Write-Host
for ($s = 5; $s -ge 0; $s--) {
$p = if ($s -eq 1) { "" } else { "s" }
Write-Host "`rPlease wait $s second$p to continue, or close now (Ctrl + C) to cancel..." -NoNewLine -ForegroundColor Yellow
Start-Sleep -Seconds 1
}
Write-Host
# Copy temp files to system
Expand-Archive "$env:Temp\WindowShade\package.zip" -DestinationPath "$env:Temp\WindowShade" -Force
Copy-Item "$env:Temp\WindowShade\0.icc" -Destination "$path\$profile 0.icc" -Force | Out-Null
Copy-Item "$env:Temp\WindowShade\25.icc" -Destination "$path\$profile 25.icc" -Force | Out-Null
Copy-Item "$env:Temp\WindowShade\50.icc" -Destination "$path\$profile 50.icc" -Force | Out-Null
Copy-Item "$env:Temp\WindowShade\75.icc" -Destination "$path\$profile 75.icc" -Force | Out-Null
Copy-Item "$env:Temp\WindowShade\100.icc" -Destination "$path\$profile 100.icc" -Force | Out-Null
# Cleanup temp files
Remove-Item "$env:Temp\WindowShade\*"
<#
INITIALIZE CALIBRATION REGISTRY
#>
Write-Host "`nInitializing calibration data for display(s)..."
Start-Sleep -Seconds 1
# Delete existing user calibration, if any
wmic process where "name='colorcpl.exe'" delete | Out-Null
$regpath = (reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations" 2>$null)
if ($regpath.length -gt 0) {
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations" /f 2>$null | Out-Null
}
$regpath = (reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles" 2>$null)
if ($regpath.length -gt 0) {
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles" /f 2>$null | Out-Null
}
# Temporarily spawn color calibration control panel to generate defaults
Start-Process -WindowStyle Minimized "$env:WinDir\System32\colorcpl.exe"
$ready = 0
Do {
Start-Sleep -Seconds 1
$ready = (Get-Process "colorcpl" -ErrorAction SilentlyContinue).length
} Until ($ready -ge 1)
wmic process where "name='colorcpl.exe'" delete | Out-Null
Start-Sleep -Seconds 1
# If initialization succeeded...
$regpath = (reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations\Display" 2>$null) -match "HKEY_CURRENT_USER"
if ($regpath.count -gt 0) {
# Get display IDs
$guid = ([regex]::Match($regpath[0], '\{(.*?)\}')).Value
$ids = @((reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations\Display\$guid" 2>$null) -match "HKEY_CURRENT_USER" | Split-Path -Leaf)
# Ensure controlset defaults exist for current display(s)
for ($i = 0; $i -lt $ids.count; $i++) {
$id = $ids[$i]
if ((reg query "HKLM\SYSTEM\ControlSet001\Control\Class\$guid\$id" 2>$null).length -eq 0) {
reg add "HKLM\SYSTEM\ControlSet001\Control\Class\$guid\$id" /t REG_MULTI_SZ /v "ICMProfile" /f 2>$null | Out-Null
}
if ((reg query "HKLM\SYSTEM\CurrentControlSet\Control\Class\$guid\$id" 2>$null).length -eq 0) {
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Class\$guid\$id" /t REG_MULTI_SZ /v "ICMProfile" /f 2>$null | Out-Null
}
}
<#
APPLY CALIBRATION TO REGISTRY
#>
Write-Host "`nUpdating system config (this may take a while)...`n"
# Set starting step count
$steps = 2
# Associate calibration profile with display(s)
$regpath = (reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations\Display" 2>$null) -match "HKEY_CURRENT_USER"
$steps += ($regpath.count*$ids.count*5)
for ($r = 0; $r -lt $regpath.count; $r++) {
$reg = $regpath[$r]
for ($i = 0; $i -lt $ids.count; $i++) {
$id = $ids[$i]
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "$reg\$id" /t REG_DWORD /v "UsePerUserProfiles" /d 1 /f
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "$reg\$id" /t REG_MULTI_SZ /v "ICMProfile" /d "$profile 75.icc" /f
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "$reg\$id" /t REG_MULTI_SZ /v "ICMProfileAC" /d "$profile 75.icc" /f
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "$reg\$id" /t REG_MULTI_SZ /v "ICMProfileSnapshot" /f
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "$reg\$id" /t REG_MULTI_SZ /v "ICMProfileSnapshotAC" /f
}
}
# Enable calibration profile
$regpath = (reg query "HKLM\SYSTEM\ControlSet001\Control\Class" /f "ICMProfile" /s /c /e) -match "HKEY_LOCAL_MACHINE"
$regpath += (reg query "HKLM\SYSTEM\CurrentControlSet\Control\Class" /f "ICMProfile" /s /c /e) -match "HKEY_LOCAL_MACHINE"
$steps += $regpath.count
for ($r = 0; $r -lt $regpath.count; $r++) {
$reg = $regpath[$r]
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "$reg" /t REG_MULTI_SZ /v "ICMProfile" /d "$profile 75.icc" /f
}
# Enable calibration management
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\Calibration" /t REG_DWORD /v "CalibrationManagementEnabled" /d 1 /f
# Register calibration profile
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles" /t REG_SZ /v "sRGB" /d "$profile 75.icc" /f
# Run calibration loader task to apply changes
Enable-ScheduledTask -TaskName "\Microsoft\Windows\WindowsColorSystem\Calibration Loader" | Out-Null
Start-ScheduledTask -TaskName "\Microsoft\Windows\WindowsColorSystem\Calibration Loader"
<#
CREATE CALIBRATION SERVICE
#>
Write-Host "`nCreating calibration service..."
# Ensure service directory exists
if (!(Test-Path -Path "$env:AppData\WindowShade")) {
New-Item -ItemType directory -Path "$env:AppData\WindowShade"
}
$service =
"<#" +
"`n//////////////////////////////////////////////////" +
"`n// WindowShade Responsive Service by Lulech23 //" +
"`n//////////////////////////////////////////////////" +
"`n" +
"`nApply brightness-responsive Windows color calibration profiles with ease!" +
"`n" +
"`nUsage:" +
"`n``.\wsservice.ps1 `"C:\0.icc`" `"C:\25.icc`" `"C:\50.icc`" `"C:\75.icc`" `"C:\100.icc`"``" +
"`n" +
"`nService MUST be run as administrator!" +
"`n" +
"`nWhat`'s New:" +
"`n* Initial release" +
"`n" +
"`nNotes:" +
"`n* " +
"`n" +
"`nTo-do:" +
"`n* " +
"`n#>" +
"`n" +
"`n<#" +
"`nINITIALIZE SYSTRAY ICON" +
"`n#>" +
"`n" +
"`n# Add assemblies" +
"`nAdd-Type -AssemblyName System.Drawing" +
"`nAdd-Type -AssemblyName System.Windows.Forms" +
"`n" +
"`n# Get systray icon" +
"`n`$icon = [System.Drawing.Icon]::ExtractAssociatedIcon(`"`$env:WinDir\System32\quickassist.exe`") " +
"`n" +
"`n# Create context menu" +
"`n`$ContextMenu = New-Object System.Windows.Forms.ContextMenu" +
"`n" +
"`n# Create context menu items" +
"`n`$ItemExit = New-Object System.Windows.Forms.MenuItem" +
"`n`$ItemExit.Text = `"Exit`"" +
"`n`$ItemExit.Add_Click({" +
"`n `$NotifyIcon.Visible = `$false" +
"`n Stop-Process `$pid" +
"`n})" +
"`n`$ContextMenu.MenuItems.Add(`$ItemExit)" +
"`n " +
"`n# Create systray icon" +
"`n`$NotifyIcon = New-Object System.Windows.Forms.NotifyIcon" +
"`n`$NotifyIcon.Text = `"WindowShade Service`"" +
"`n`$NotifyIcon.Icon = `$icon" +
"`n`$NotifyIcon.Visible = `$true" +
"`n`$NotifyIcon.ContextMenu = `$ContextMenu" +
"`n" +
"`n# Hide PowerShell window" +
"`n`$WindowCode = `'[DllImport(`"user32.dll`")] public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);`'" +
"`n`$AsyncWindow = Add-Type -MemberDefinition `$WindowCode -name Win32ShowWindowAsync -namespace Win32Functions -PassThru" +
"`n`$null = `$AsyncWindow::ShowWindowAsync((Get-Process -PID `$PID).MainWindowHandle, 0)" +
"`n" +
"`n" +
"`n<#" +
"`nINITIALIZE SERVICE" +
"`n#>" +
"`n" +
"`n# Initialize display IDs" +
"`n`$guid = `"{4d36e96e-e325-11ce-bfc1-08002be10318}`"" +
"`n`$ids = @((reg query `"HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations\Display\`$guid`" 2>`$null) -match `"HKEY_CURRENT_USER`" | Split-Path -Leaf)" +
"`n" +
"`n# Initialize display profiles" +
"`n`$Profile = 0..100" +
"`n`$Profile[0] = (Get-Item `"`$(`$args[0])`").Name" +
"`n`$Profile[25] = (Get-Item `"`$(`$args[1])`").Name" +
"`n`$Profile[50] = (Get-Item `"`$(`$args[2])`").Name" +
"`n`$Profile[75] = (Get-Item `"`$(`$args[3])`").Name" +
"`n`$Profile[100] = (Get-Item `"`$(`$args[4])`").Name" +
"`n`$CurrentProfile = `"`"" +
"`n" +
"`n# Initialize display brightness" +
"`n`$Brightness = -1" +
"`n`$CurrentBrightness = 0" +
"`n" +
"`n# Initialize functions" +
"`nfunction Round-To(`$n, `$v) {" +
"`n return [math]::Floor(`$n/`$v)*`$v;" +
"`n}" +
"`n" +
"`n" +
"`n<#" +
"`nPERFORM SERVICE" +
"`n#>" +
"`n" +
"`n# Listen for changes in brightness" +
"`nfor (;;) {" +
"`n `$CurrentBrightness = (Get-Ciminstance -Namespace root/WMI -ClassName WmiMonitorBrightness).CurrentBrightness" +
"`n `$CurrentBrightness = (Round-To `$CurrentBrightness 25)" +
"`n" +
"`n # If brightness has changed..." +
"`n if (`$Brightness -ne `$CurrentBrightness) {" +
"`n Get-Date -Format `"``n[MM/dd/yyyy HH:mm]`" | Write-Host -ForegroundColor Gray" +
"`n Write-Host `"Detected brightness adjustment`" -ForegroundColor Yellow " +
"`n Write-Host `"Previous value: `$Brightness, New value: `$CurrentBrightness`"" +
"`n Write-Host `"``nSetting brightness profile...`" -ForegroundColor Cyan" +
"`n" +
"`n # Get profile based on brightness" +
"`n `$CurrentProfile = `$Profile[`$CurrentBrightness]" +
"`n for (`$i = 0; `$i -lt `$ids.count; `$i++) {" +
"`n `$id = `$ids[`$i]" +
"`n" +
"`n # Associate calibration profile with display(s)" +
"`n `$regpath = `"HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations\Display\`$guid`"" +
"`n reg add `"`$regpath\`$id`" /t REG_MULTI_SZ /v `"ICMProfile`" /d `"`$CurrentProfile`" /f" +
"`n reg add `"`$regpath\`$id`" /t REG_MULTI_SZ /v `"ICMProfileAC`" /d `"`$CurrentProfile`" /f" +
"`n reg add `"`$regpath\`$id`" /t REG_MULTI_SZ /v `"ICMProfileSnapshot`" /f" +
"`n reg add `"`$regpath\`$id`" /t REG_MULTI_SZ /v `"ICMProfileSnapshotAC`" /f" +
"`n " +
"`n # Enable calibration profile" +
"`n `$regpath = `"HKLM\SYSTEM\ControlSet001\Control\Class\`$guid`"" +
"`n reg add `"`$regpath\`$id`" /t REG_MULTI_SZ /v `"ICMProfile`" /d `"`$CurrentProfile`" /f" +
"`n `$regpath = `"HKLM\SYSTEM\CurrentControlSet\Control\Class\`$guid`"" +
"`n reg add `"`$regpath\`$id`" /t REG_MULTI_SZ /v `"ICMProfile`" /d `"`$CurrentProfile`" /f" +
"`n }" +
"`n " +
"`n # Run calibration loader task to apply changes" +
"`n Enable-ScheduledTask -TaskName `"\Microsoft\Windows\WindowsColorSystem\Calibration Loader`" | Out-Null" +
"`n Start-ScheduledTask -TaskName `"\Microsoft\Windows\WindowsColorSystem\Calibration Loader`"" +
"`n" +
"`n # Update brightness check" +
"`n `$Brightness = `$CurrentBrightness" +
"`n }" +
"`n" +
"`n # Set brightness check frequency" +
"`n Start-Sleep 1" +
"`n}"
# Create calibration service
Set-Content -Path "$env:AppData\WindowShade\wsservice.ps1" -Value $service -Force
<#
CREATE CALIBRATION TASK
#>
$service =
"<?xml version=`"1.0`" encoding=`"UTF-16`"?>" +
"`n<Task version=`"1.4`" xmlns=`"http://schemas.microsoft.com/windows/2004/02/mit/task`">" +
"`n <RegistrationInfo>" +
"`n <Date>2021-07-02T17:30:28.6095531</Date>" +
"`n <Author>BUILTIN\Administrators</Author>" +
"`n <Description>Runs the WindowShade service for brightness-responsive calibration profiles</Description>" +
"`n <URI>\WindowShade\WindowShade Service</URI>" +
"`n </RegistrationInfo>" +
"`n <Triggers>" +
"`n <LogonTrigger>" +
"`n <Enabled>true</Enabled>" +
"`n </LogonTrigger>" +
"`n </Triggers>" +
"`n <Principals>" +
"`n <Principal id=`"Author`">" +
"`n <GroupId>S-1-5-32-544</GroupId>" +
"`n <RunLevel>HighestAvailable</RunLevel>" +
"`n </Principal>" +
"`n </Principals>" +
"`n <Settings>" +
"`n <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>" +
"`n <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>" +
"`n <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>" +
"`n <AllowHardTerminate>true</AllowHardTerminate>" +
"`n <StartWhenAvailable>true</StartWhenAvailable>" +
"`n <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>" +
"`n <IdleSettings>" +
"`n <StopOnIdleEnd>false</StopOnIdleEnd>" +
"`n <RestartOnIdle>false</RestartOnIdle>" +
"`n </IdleSettings>" +
"`n <AllowStartOnDemand>true</AllowStartOnDemand>" +
"`n <Enabled>true</Enabled>" +
"`n <Hidden>false</Hidden>" +
"`n <RunOnlyIfIdle>false</RunOnlyIfIdle>" +
"`n <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>" +
"`n <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>" +
"`n <WakeToRun>false</WakeToRun>" +
"`n <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>" +
"`n <Priority>7</Priority>" +
"`n </Settings>" +
"`n <Actions Context=`"Author`">" +
"`n <Exec>" +
"`n <Command>powershell</Command>" +
"`n <Arguments>-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$env:AppData\WindowShade\wsservice.ps1`" `"$path\$profile 0.icc`" `"$path\$profile 25.icc`" `"$path\$profile 50.icc`" `"$path\$profile 75.icc`" `"$path\$profile 100.icc`"</Arguments>" +
"`n </Exec>" +
"`n </Actions>" +
"`n</Task>"
# Create calibration task
Set-Content -Path "$env:AppData\WindowShade\wstask.xml" -Value $service -Force
# Import task to Windows scheduler
$task = (Get-ScheduledTask "WindowShade Service" -ErrorAction "SilentlyContinue" | Out-String)
if ($task.length -gt 0) {
# Delete old task, if any
Unregister-ScheduledTask -TaskName "WindowShade Service" -Confirm:$False -ErrorAction "SilentlyContinue"
}
Register-ScheduledTask -TaskName "WindowShade Service" -Xml (Get-Content "$env:AppData\WindowShade\wstask.xml" | Out-String)
# Run imported task
Enable-ScheduledTask -TaskName "WindowShade Service" | Out-Null
Start-ScheduledTask -TaskName "WindowShade Service"
# Ensure task creation succeeded
$task = (Get-ScheduledTask "WindowShade Service" -ErrorAction "SilentlyContinue" | Out-String)
# End process, we're done!
if ($task.length -gt 0) {
Write-Host "`nProcess complete! " -NoNewline -ForegroundColor Green
Write-Host "New calibration profile installed successfully. Enjoy!"
Write-Host "If you liked this, stop by my website at " -NoNewline
Write-Host "https://lucasc.me" -NoNewline -ForegroundColor Yellow
Write-Host "!"
} else {
# Show error if service creation failed
Write-Host "`nCreating calibration service failed!" -ForegroundColor Magenta
Write-Host "`nPlease import `"$env:AppData\WindowShade\wstask.xml`" to Task Scheduler"
Write-Host "manually, if it exists."
}
} else {
# Show error if initialization failed
Write-Host "Initializing calibration data failed!" -ForegroundColor Magenta
Write-Host "`nPlease start display calibration manually to restore defaults and run this script again."
}
}
}
<#
UNINSTALL PROFILE
#>
if ($task -eq 3) {
Write-Host "`nUnregistering calibration service..."
Start-Sleep -Seconds 1
# Unregister calibration service
Stop-ScheduledTask -TaskName "WindowShade Service" | Out-Null
Unregister-ScheduledTask -TaskName "WindowShade Service" -Confirm:$False -ErrorAction "SilentlyContinue"
Remove-Item "$env:AppData\WindowShade\*"
# Revert display calibration
Write-Host "`nReverting display calibration (this may take a while)...`n"
Start-Sleep -Seconds 1
# Set starting step count
$steps = 2
# Unregister user calibration profile
$regpath = (reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles" 2>$null)
if ($regpath.length -gt 0) {
$steps++; $step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles" /f
}
# Disassociate calibration profile from display(s)
$regpath = (reg query "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations" 2>$null)
if ($regpath.length -gt 0) {
$steps++; $step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\ProfileAssociations" /f
}
# Disable calibration profile
$regpath = (reg query "HKLM\SYSTEM\ControlSet001\Control\Class" /f "ICMProfile" /s /c /e) -match "HKEY_LOCAL_MACHINE"
$regpath += (reg query "HKLM\SYSTEM\CurrentControlSet\Control\Class" /f "ICMProfile" /s /c /e) -match "HKEY_LOCAL_MACHINE"
$steps += $regpath.count
for ($r = 0; $r -lt $regpath.count; $r++) {
$reg = $regpath[$r]
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg delete "$reg" /v ICMProfile /f
}
# Disable calibration management
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\Calibration" /t REG_DWORD /v "CalibrationManagementEnabled" /d 0 /f
# Unregister system calibration profile
$step++; Write-Host "($step/$steps) " -NoNewline -ForegroundColor Cyan
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ICM\RegisteredProfiles" /v "sRGB" /f
# Run calibration loader task to apply changes
Enable-ScheduledTask -TaskName "\Microsoft\Windows\WindowsColorSystem\Calibration Loader" | Out-Null
Start-ScheduledTask -TaskName "\Microsoft\Windows\WindowsColorSystem\Calibration Loader"
# End process, we're done!
Write-Host "`nProcess complete! " -NoNewline -ForegroundColor Green
Write-Host "Original calibration restored. Enjoy, I guess..."
}
<#
CREATE PACKAGE
#>
if ($task -eq 4) {
# Initialize package profiles
$profile = 0..100
$p = 0
# Initialize file browser
Add-Type -AssemblyName System.Windows.Forms
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
InitialDirectory = [Environment]::GetFolderPath("MyComputer")
Filter = "ICC Profile (*.icc;*.icm)|*.icc;*.icm"
Title = "Select a color calibration profile"
}
<#
GET PROFILES
#>
# Prompt for external profile, if not supplied
:browse while ($profile[$p].length -le 1) {
Write-Host "`nSelect an *.icc\*.icm profile for $p-$([math]::min($p + 24, 100))% brightness"
Read-Host "Press ENTER to open file browser"
$null = $FileBrowser.ShowDialog()
$profile[$p] = $FileBrowser.FileName
# Ensure valid selection
if ($profile[$p].length -gt 1) {
if (!(Test-Path -Path "$($profile[0])")) {
$profile[$p] = ""
}
}
if ($profile[$p].length -le 1) {
Write-Host "ERROR: " -NoNewline -ForegroundColor Red
Write-Host "Invalid selection. Please cancel or try again."
Write-Host
$FileBrowser.FileName = ""
$profile[$p] = ""
$retry = Read-Host "Continue? (Y/N)"
# Exit if cancelled
if ($retry.Trim().ToUpper() -eq "N") {
$task = -1;
break;
}
} else {
# Show selected profile
Write-Host "Selected: " -NoNewline -ForegroundColor Yellow
Write-Host "$($profile[$p])"
# Reset file browser properties
$FileBrowser.InitialDirectory = (Split-Path -parent "$($profile[$p])")
$FileBrowser.FileName = ""
# Continue to next file
switch ($p) {
0 { $p = 25; break; }
25 { $p = 50; break; }
50 { $p = 75; break; }
75 { $p = 100; break; }
100 { break browse; }
}
}
}
if ($task -gt 0) {
Write-Host
<#
CREATE PACKAGE
#>
# Ensure empty temp directory exists
if (!(Test-Path -Path "$env:Temp\WindowShade")) {
New-Item -ItemType directory -Path "$env:Temp\WindowShade"
} else {
Remove-Item "$env:Temp\WindowShade\*"
}
# Copy files to temp directory and rename
Copy-Item "$($profile[0])" -Destination "$env:Temp\WindowShade\0.icc"
Copy-Item "$($profile[25])" -Destination "$env:Temp\WindowShade\25.icc"
Copy-Item "$($profile[50])" -Destination "$env:Temp\WindowShade\50.icc"
Copy-Item "$($profile[75])" -Destination "$env:Temp\WindowShade\75.icc"
Copy-Item "$($profile[100])" -Destination "$env:Temp\WindowShade\100.icc"
# Create profile package
Compress-Archive -Path "$env:Temp\WindowShade\*" -DestinationPath "$env:Temp\WindowShade\package.zip" -Force
<#
SAVE PACKAGE
#>
# Initialize file browser
$package = "";
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog -Property @{
InitialDirectory = [Environment]::GetFolderPath("MyComputer")
Filter = "ICZ Package (*.icz)|*.icz"
Title = "Choose a location to save calibration profile package"
}
# Prompt for save location
while ($package.length -eq 0) {
$null = $FileBrowser.ShowDialog()
$package = $FileBrowser.FileName
# Ensure valid filname
if ($package.length -le 1) {
Write-Host "`nERROR: " -NoNewline -ForegroundColor Red
Write-Host "Invalid location or filename. Please cancel or try again."
Write-Host
$FileBrowser.FileName = ""
$package = ""
$retry = Read-Host "Continue? (Y/N)"
# Exit if cancelled
if ($retry.Trim().ToUpper() -eq "N") {
$task = -1;
break;
}
}
}
if ($task -gt 0) {
# Save package to chosen location
Copy-Item "$env:Temp\WindowShade\package.zip" "$package" -Force
# Cleanup temp files
Remove-Item "$env:Temp\WindowShade\*"
# End process, we're done!
Write-Host "Process complete! " -NoNewline -ForegroundColor Green
Write-Host "Calibration package saved to:"
Write-Host "$package"
}
}
}
<#
FINALIZATION
#>
# Exit, we're done!
Write-Host
for ($s = 5; $s -ge 0; $s--) {
$p = if ($s -eq 1) { "" } else { "s" }
Write-Host "`rSetup will cleanup and exit in $s second$p, please wait..." -NoNewLine -ForegroundColor Yellow
Start-Sleep -Seconds 1
}
Write-Host
Write-Host "`nCleaning up..."
Start-Sleep -Seconds 1
# Reset execution policy and delete temporary script file
$policy = "Default"
if (Test-Path -Path "$env:Temp\executionpolicy.txt") {
$policy = [string] (Get-Content -Path "$env:Temp\executionpolicy.txt")
}
Start-Process powershell.exe "Set-ExecutionPolicy -Scope 'CurrentUser' -ExecutionPolicy '$policy'; Remove-Item -Path '$env:Temp\executionpolicy.txt' -Force; Remove-Item -Path '$PSCommandPath' -Force"