cursor adding

This commit is contained in:
2025-10-16 21:23:25 +03:00
parent 1718b68c64
commit 73257be5c2
3 changed files with 68 additions and 0 deletions
+1
View File
@@ -12,6 +12,7 @@ $Modules = @(
@{ Name = 'mountsManagerModule'; Apply = 'reconnect'; Clean = 'disconnect' }
@{ Name = 'wingetInstallerModule'; Apply = 'install'; Clean = 'check' }
@{ Name = 'packageManagerModule'; Apply = 'install'; Clean = 'uninstall' }
@{ Name = 'windowsCursorModule'; Apply = 'install'; Clean = 'uninstall' }
)
foreach ($module in $Modules) {
+62
View File
@@ -0,0 +1,62 @@
param(
[Parameter(Mandatory=$true)]
[ValidateSet("install","uninstall")]
[string]$Mode
)
# === Настройки ===
$InfPath = "$Storage\Windows\Cursor\default\Install.inf"
$SchemeName = "W11 Cursors Dark HDPI default (small) by Jepri Creations"
$DefaultScheme = "Windows Aero"
# === Проверка наличия файла ===
if ($Mode -eq "install" -and -not (Test-Path $InfPath)) {
Write-Host "INF file not found: $InfPath" -ForegroundColor Red
exit 1
}
# === Функция обновления системных параметров ===
function Refresh-Cursors {
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class WinAPI {
[DllImport("user32.dll", SetLastError = true)]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, string pvParam, uint fWinIni);
}
"@ | Out-Null
[WinAPI]::SystemParametersInfo(0x0057, 0, $null, 0x01 -bor 0x02) | Out-Null
}
# === Основная логика ===
switch ($Mode) {
"install" {
Write-Host "Installing cursor theme..." -ForegroundColor Cyan
try {
rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 132 "$InfPath" | Out-Null
Set-ItemProperty "HKCU:\Control Panel\Cursors" -Name "(Default)" -Value $SchemeName
Refresh-Cursors
Write-Host "Cursor scheme '$SchemeName' installed and applied." -ForegroundColor Green
}
catch {
Write-Host "Failed to install cursor scheme: $($_.Exception.Message)" -ForegroundColor Red
}
}
"uninstall" {
Write-Host "WIP..." -ForegroundColor Cyan
# Write-Host "Uninstalling cursor theme..." -ForegroundColor Cyan
# try {
# Set-ItemProperty "HKCU:\Control Panel\Cursors" -Name "(Default)" -Value $DefaultScheme
# Remove-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name $SchemeName -ErrorAction SilentlyContinue
# Refresh-Cursors
# Write-Host "Cursor scheme '$SchemeName' removed. Default restored." -ForegroundColor Green
# }
# catch {
# Write-Host "Failed to uninstall cursor scheme: $($_.Exception.Message)" -ForegroundColor Red
# }
}
}
Write-Host "Done." -ForegroundColor White
+5
View File
@@ -5,6 +5,7 @@ $mountsManagerModule = "$PSScriptRoot\modules\mounts-manager.ps1"
$deployModule = "$PSScriptRoot\modules\deploy.ps1"
$wingetInstallerModule = "$PSScriptRoot\modules\winget-installer.ps1"
$packageManagerModule = "$PSScriptRoot\modules\package-manager.ps1"
$windowsCursorModule = "$PSScriptRoot\modules\windows-cursor.ps1"
# Define available modules with their respective actions - need to ref
$modules = @{
@@ -32,6 +33,10 @@ $modules = @{
Path = $wingetInstallerModule
Actions = @("check", "install")
}
"Windows Cursor" = @{
Path = $windowsCursorModule
Actions = @("install", "uninstall")
}
}