Add install.ps1 and update README with install docs
This commit is contained in:
14
README.md
14
README.md
@@ -10,12 +10,22 @@ FuckCapsLock installs a low-level Windows keyboard hook (`WH_KEYBOARD_LL` — `S
|
|||||||
|
|
||||||
No driver, no service, no admin rights required. It's a single-user-mode userland hook that runs in your session's context.
|
No driver, no service, no admin rights required. It's a single-user-mode userland hook that runs in your session's context.
|
||||||
|
|
||||||
## Usage
|
## Quick Install
|
||||||
|
|
||||||
|
Run the included `install.ps1` as Administrator from the repo root:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Right-click install.ps1 -> Run with PowerShell (Run as Administrator)
|
||||||
|
```
|
||||||
|
|
||||||
|
This copies `fuckcapslock.exe` to `C:\Program Files\FuckCapsLock\`, sets up auto-start in the registry (HKLM — all users), and launches the app immediately.
|
||||||
|
|
||||||
|
## Usage (Manual)
|
||||||
|
|
||||||
1. Run `fuckcapslock.exe` — it minimizes to the system tray immediately
|
1. Run `fuckcapslock.exe` — it minimizes to the system tray immediately
|
||||||
2. Caps Lock is now permanently disabled — pressing it does nothing
|
2. Caps Lock is now permanently disabled — pressing it does nothing
|
||||||
3. To restore Caps Lock, right-click the tray icon and select **Exit**
|
3. To restore Caps Lock, right-click the tray icon and select **Exit**
|
||||||
4. The app registers itself in `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` for auto-start on next boot
|
4. Without the installer, the app registers itself in `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` on first launch for per-user auto-start
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|||||||
45
install.ps1
Normal file
45
install.ps1
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# FuckCapsLock Installer
|
||||||
|
# Run as Administrator: right-click -> Run with PowerShell (Run as Administrator)
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$DestDir = "$env:ProgramFiles\FuckCapsLock"
|
||||||
|
$ExeName = "fuckcapslock.exe"
|
||||||
|
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
|
||||||
|
$RegName = "FuckCapsLock"
|
||||||
|
|
||||||
|
# Source exe: assume script is in the repo root, exe is in out/
|
||||||
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$SourceExe = Join-Path $ScriptDir "out" $ExeName
|
||||||
|
|
||||||
|
if (-not (Test-Path $SourceExe)) {
|
||||||
|
Write-Error "Could not find $SourceExe — make sure this script is run from the repo root."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Require admin
|
||||||
|
$IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||||
|
if (-not $IsAdmin) {
|
||||||
|
Write-Error "This script must be run as Administrator."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create destination directory
|
||||||
|
if (-not (Test-Path $DestDir)) {
|
||||||
|
New-Item -ItemType Directory -Path $DestDir -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Copy exe
|
||||||
|
Copy-Item -Path $SourceExe -Destination (Join-Path $DestDir $ExeName) -Force
|
||||||
|
Write-Host "Copied $ExeName to $DestDir"
|
||||||
|
|
||||||
|
# Set registry auto-start (HKLM = all users, starts before user logon)
|
||||||
|
$ExePath = Join-Path $DestDir $ExeName
|
||||||
|
Set-ItemProperty -Path $RegPath -Name $RegName -Value $ExePath
|
||||||
|
Write-Host "Registry auto-start set: $RegPath\$RegName = $ExePath"
|
||||||
|
|
||||||
|
# Launch
|
||||||
|
Start-Process -FilePath $ExePath
|
||||||
|
Write-Host "FuckCapsLock launched."
|
||||||
|
Write-Host ""
|
||||||
|
Write-Host "Done. Caps Lock is now permanently disabled until you right-click"
|
||||||
|
Write-Host "the tray icon and select Exit."
|
||||||
Reference in New Issue
Block a user