Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions autorun.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
param (
[ValidateNotNullOrEmpty()][string]$SettingsFile = "$(Join-Path $Env:LOCALAPPDATA (Join-Path 'Raw Accel' 'settings.json'))"
)

$SettingsFile = Convert-Path($SettingsFile)
$settingsDirectory = [IO.Path]::GetDirectoryName($SettingsFile)
$settingsFileName = [IO.Path]::GetFileName($SettingsFile)

$rawaccel_exe = Join-Path $PSScriptRoot rawaccel.exe
$writer_exe = Join-Path $PSScriptRoot writer.exe

if (Test-Path -PathType 'Container' -Path $settingsDirectory) {
Start-Process -WorkingDirectory $settingsDirectory -FilePath $writer_exe -ArgumentList $settingsFileName
} elseif (New-Item -ItemType 'directory' -Path $settingsDirectory -Force) {
Start-Process -WorkingDirectory $settingsDirectory -FilePath $rawaccel_exe
}
12 changes: 11 additions & 1 deletion doc/Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ Visit the [Releases page](https://github.com/a1xd/rawaccel/releases) and navigat
* Visual C++ 2019 runtime, [download here](https://aka.ms/vs/16/release/vc_redist.x64.exe)
* .NET Framework 4.7.2+ runtime, [download here](https://dotnet.microsoft.com/download/dotnet-framework/net48)

We recommend extracting the release directory into `%PROGRAMFILES%\Raw Accel`.

- Run `installer.exe` in the release directory to install the Raw Accel driver. Restart your computer for the installation to take effect.

- Run `uninstaller.exe` in the release directory to uninstall the driver. Restart for the uninstallation to take effect.
- Run `install-autorun.ps1` in the release directory to enable user specific settings on sign in for each user. The settings are stored in `%LOCALAPPDATA%\Raw Accel`.

- Run `install-shortcut.ps1` in the release directory to add a user specific shortcut to the Raw Accel GUI. The settings are stored in `%LOCALAPPDATA%\Raw Accel`. Sign out and back in for the installation to take effect.

- Run `rawaccel.exe` when the driver is installed in order to run the Raw Accel GUI.

## Uninstallation

- Run `uninstall-autorun.ps1` in the release directory to disable user specific settings.

- Run `uninstaller.exe` in the release directory to uninstall the driver. Restart for the uninstallation to take effect.

## Philosophy
The Raw Accel driver and GUI's workings and exposed parameters are based on our understanding of mouse acceleration. Our understanding includes the concepts of "[gain](#gain-switch)", "[whole vs by component](#horizontal-and-vertical)", and "[anisotropy](#anisotropy)." For clarity, we will outline this understanding here. Those uninterested can skip to [Features](#features) below.

Expand Down
27 changes: 27 additions & 0 deletions install-autorun.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Run as administrator
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
Start-Process -WorkingDirectory $PWD -FilePath PowerShell.exe -Verb Runas -ArgumentList $(('-File "{0}"' -f $MyInvocation.MyCommand.Path); $MyInvocation.UnboundArguments)
Exit
}

$autorunScript = Join-Path $PSScriptRoot autorun.ps1
$stateChangeTrigger = Get-CimClass `
-Namespace ROOT\Microsoft\Windows\TaskScheduler `
-ClassName MSFT_TaskSessionStateChangeTrigger

Register-ScheduledTask `
-Force `
-TaskName 'Autorun on sign in' `
-TaskPath '\Raw Accel\' `
-Description 'Apply user specific Raw Accel settings at sign in for each user.' `
-Principal (New-ScheduledTaskPrincipal -GroupId Users) `
-Trigger (New-ScheduledTaskTrigger -AtLogOn), `
(
New-CimInstance $stateChangeTrigger `
-Property @{
StateChange = 8 # TASK_SESSION_STATE_CHANGE_TYPE.TASK_SESSION_UNLOCK (taskschd.h)
} `
-ClientOnly
) `
-Action (New-ScheduledTaskAction -Execute 'PowerShell' -Argument ('-WindowStyle Hidden -File "{0}"' -f $autorunScript)) `
-Settings (New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -ExecutionTimeLimit 0)
14 changes: 14 additions & 0 deletions install-shortcut.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Run as administrator
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
Start-Process -WorkingDirectory $PWD -FilePath PowerShell.exe -Verb Runas -ArgumentList $(('-File "{0}"' -f $MyInvocation.MyCommand.Path); $MyInvocation.UnboundArguments)
Exit
}

$rawaccel_exe = Join-Path $PSScriptRoot rawaccel.exe

$shell = New-Object -comObject WScript.Shell
$shortcut = $shell.CreateShortcut("$Env:PROGRAMDATA\Microsoft\Windows\Start Menu\Programs\Raw Accel.lnk")
$shortcut.TargetPath = $rawaccel_exe
$Shortcut.WorkingDirectory = '%LOCALAPPDATA%\Raw Accel'
$Shortcut.Description = 'Edit mouse acceleration curves'
$shortcut.Save()
10 changes: 10 additions & 0 deletions uninstall-autorun.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run as administrator
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
Start-Process -WorkingDirectory $PWD -FilePath PowerShell.exe -Verb Runas -ArgumentList $(('-File "{0}"' -f $MyInvocation.MyCommand.Path); $MyInvocation.UnboundArguments)
Exit
}

Unregister-ScheduledTask `
-TaskName 'Autorun on sign in' `
-TaskPath '\Raw Accel\' `
-Confirm:$false