From a8de8f95c09b1de2cdde77f72a7103d3746eb773 Mon Sep 17 00:00:00 2001 From: gramps Date: Tue, 30 Jun 2026 17:02:44 -0700 Subject: [PATCH] Add install.ps1 and update README with install docs --- README.md | 14 ++++++++++++-- install.ps1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 install.ps1 diff --git a/README.md b/README.md index 189f0d4..0630922 100644 --- a/README.md +++ b/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. -## 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 2. Caps Lock is now permanently disabled — pressing it does nothing 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 diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..101081a --- /dev/null +++ b/install.ps1 @@ -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."