-
Notifications
You must be signed in to change notification settings - Fork 274
Add Autostart and Per-User Settings #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
0xFurtiv
wants to merge
8
commits into
RawAccelOfficial:master
Choose a base branch
from
0xFurtiv:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b653f22
Add autorun files
0xFurtiv 482cde0
Rename $unlockScript to $autorunScript
0xFurtiv 11eec99
Update Guide to include autorun
0xFurtiv b31befa
Add shortcut installer
0xFurtiv 8251ad8
Add shortcut installation instructions
0xFurtiv 21bbd0c
Update Guide.md
0xFurtiv 2ac90de
Use ProgramData environment variable for start menu path
0xFurtiv dd33d44
Change copying → extracting
0xFurtiv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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 | ||
| } | ||
This file contains hidden or 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
This file contains hidden or 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,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) |
This file contains hidden or 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,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() |
This file contains hidden or 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,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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.