-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7427b84
Showing
137 changed files
with
582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
Resources/Preferences | ||
Resources/Custom Cursor/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#Requires -RunAsAdministrator | ||
#Requires -Version 5.1 | ||
|
||
#region Preparation | ||
$ErrorActionPreference = 'Stop' | ||
[Console]::Title = 'Cursor Colors Synchronizer' | ||
Remove-Module -Name Functions -ErrorAction SilentlyContinue | ||
Clear-Variable -Name Localization, windowsTheme, cursorSize, useClassicWheel, useAlternatePrecision, originalCursorFolder, customCursorFolder, byteDiffFolder, useListener, input -ErrorAction SilentlyContinue | ||
Import-LocalizedData -BindingVariable Localization -BaseDirectory $PSScriptRoot\Localizations -FileName Strings | ||
Import-Module -Name $PSScriptRoot\Functions.ps1 | ||
#endregion | ||
|
||
#region Dialogs | ||
do { | ||
Clear-Host | ||
Write-Host | ||
Write-Host -Object $Localization.ChooseSizeDialogTitle | ||
Write-Host | ||
Write-Host -Object ('1) ' + $Localization.Small) | ||
Write-Host -Object ('2) ' + $Localization.Regular) | ||
Write-Host -Object ('3) ' + $Localization.Big) | ||
Write-Host | ||
$input = Read-Host -Prompt $Localization.ChooseDialogPromt | ||
} until ( Validate-Input -Object $input -Values (1..3) ) | ||
switch ($input) { | ||
1 {$cursorSize = 'small'} | ||
2 {$cursorSize = 'regular'} | ||
3 {$cursorSize = 'big'} | ||
} | ||
|
||
do { | ||
Clear-Host | ||
Write-Host | ||
Write-Host -Object $Localization.ChooseWheelDialogTitle | ||
Write-Host | ||
Write-Host -Object ('1) ' + $Localization.No) | ||
Write-Host -Object ('2) ' + $Localization.Yes) | ||
Write-Host | ||
$input = Read-Host -Prompt $Localization.ChooseDialogPromt | ||
} until ( Validate-Input -Object $input -Values (1..2) ) | ||
switch ($input) { | ||
1 {$useClassicWheel = $false} | ||
2 {$useClassicWheel = $true} | ||
} | ||
|
||
do { | ||
Clear-Host | ||
Write-Host | ||
Write-Host -Object $Localization.ChoosePrecisionDialogTitle | ||
Write-Host | ||
Write-Host -Object ('1) ' + $Localization.Yes) | ||
Write-Host -Object ('2) ' + $Localization.No) | ||
Write-Host | ||
$input = Read-Host -Prompt $Localization.ChooseDialogPromt | ||
} until ( Validate-Input -Object $input -Values (1..2) ) | ||
switch ($input) { | ||
1 {$useAlternatePrecision = $true} | ||
2 {$useAlternatePrecision = $false} | ||
} | ||
|
||
do { | ||
Clear-Host | ||
Write-Host | ||
Write-Host -Object $Localization.ListenerDialogTitle | ||
Write-Host | ||
Write-Host -Object ('1) ' + $Localization.Yes) | ||
Write-Host -Object ('2) ' + $Localization.No) | ||
Write-Host | ||
$input = Read-Host -Prompt $Localization.ChooseDialogPromt | ||
} until ( Validate-Input -Object $input -Values (1..2) ) | ||
switch ($input) { | ||
1 {$useListener = $true} | ||
2 {$useListener = $false} | ||
} | ||
#endregion | ||
|
||
|
||
#region Variables | ||
$windowsTheme = Get-WindowsTheme | ||
$originalCursorFolder = "$PSScriptRoot\Resources\Original Cursors\$windowsTheme\$cursorSize" | ||
$byteDiffFolder = "$PSScriptRoot\Resources\Byte Diff\$cursorSize" | ||
$customCursorFolder = "$PSScriptRoot\Resources\Custom Cursor" | ||
#endregion | ||
|
||
#region Cursor | ||
Copy-Item -Path $originalCursorFolder\default\* -Destination $customCursorFolder -Recurse -Force | ||
if ($useClassicWheel -eq $false) { | ||
if ( ($windowsTheme -eq 'light') -and ($cursorSize -eq 'big') ) { | ||
Create-PatchedCursorFiles -CursorPath $originalCursorFolder\default -DiffPath $byteDiffFolder -UseAlternateDiff $true | ||
} | ||
else { | ||
Create-PatchedCursorFiles -CursorPath $originalCursorFolder\default -DiffPath $byteDiffFolder | ||
} | ||
} | ||
else { | ||
Copy-Item -Path $originalCursorFolder\alternatives\busy.ani -Destination $customCursorFolder -Force | ||
Copy-Item -Path $originalCursorFolder\alternatives\working.ani -Destination $customCursorFolder -Force | ||
} | ||
if ($useAlternatePrecision) { | ||
Copy-Item -Path $originalCursorFolder\alternatives\precision.cur -Destination $customCursorFolder -Force | ||
} | ||
Install-CursorFromFolder -Path $customCursorFolder | ||
Apply-Changes | ||
#endregion | ||
|
||
#region Parameters | ||
Set-Content -Path $PSScriptRoot\Resources\Preferences -Value $cursorSize | ||
Add-Content -Path $PSScriptRoot\Resources\Preferences -Value $useClassicWheel | ||
Add-Content -Path $PSScriptRoot\Resources\Preferences -Value $useAlternatePrecision | ||
#endregion | ||
|
||
#region Listener | ||
if ($useListener) { | ||
$name = 'CCS Listener' | ||
$action = New-ScheduledTaskAction -Execute powershell.exe -Argument ("-ExecutionPolicy Bypass -WindowStyle Hidden -File $PSScriptRoot\Listener.ps1") | ||
$user = whoami | ||
$trigger = New-ScheduledTaskTrigger -AtLogOn -User $user | ||
$description = $Localization.ListenerTaskDescription | ||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -StartWhenAvailable -DontStopIfGoingOnBatteries -ExecutionTimeLimit '00:00:00' | ||
Stop-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue | ||
Register-ScheduledTask -TaskName $name -Description $description -Action $action -Trigger $trigger -Settings $settings -RunLevel Highest -Force | Out-Null | ||
Start-Sleep 1 | ||
Start-ScheduledTask -TaskName $name | ||
} | ||
#endregion | ||
|
||
#region Final Messages | ||
Clear-Host | ||
Write-Host | ||
Write-Host -Object $Localization.SuccessMessage -ForegroundColor Green | ||
Write-Host | ||
Write-Host -Object $Localization.GitHubReminderMessage | ||
Write-Host | ||
Pause | ||
exit | ||
#endregion |
Oops, something went wrong.