Skip to content
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

Define keyboard shortcuts on launch by XML file in %AppData%, and install with WiX #39

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ Or in tray mode with
hap.exe /tray
```

## To customize

Hotkeys can be found at and modified at %AppData%\\Local\\HuntAndPeck\\[VERSION NUMBER]\\user.config.xml

Please supply a [key code](https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.keys?view=windowsdesktop-6.0) and one or more modifier keys Alt, Control, Shift, Windows. Seperate them with a comma as seen here.

# Supported Elements
Only UI Automation elements with "Invoke" patterns are supported (and displayed).
28 changes: 26 additions & 2 deletions src/HuntAndPeck.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.15
# Visual Studio Version 16
VisualStudioVersion = 16.0.32126.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeMethods", "NativeMethods\NativeMethods.csproj", "{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}"
EndProject
Expand All @@ -20,6 +20,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HuntAndPeck.Tests", "HuntAndPeck.Tests\HuntAndPeck.Tests.csproj", "{043555C4-568F-4ECD-B064-6C3DC1EA3124}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MSI", "MSI\MSI.wixproj", "{44C8FB68-8EB3-4872-8163-3370239215F9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,18 +30,40 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Debug|x86.ActiveCfg = Debug|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Debug|x86.Build.0 = Debug|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Release|Any CPU.Build.0 = Release|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Release|x86.ActiveCfg = Release|Any CPU
{556F1A03-8752-4C41-BB29-E7FA7FF68CD9}.Release|x86.Build.0 = Release|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Debug|x86.ActiveCfg = Debug|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Debug|x86.Build.0 = Debug|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Release|Any CPU.Build.0 = Release|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Release|x86.ActiveCfg = Release|Any CPU
{D9A0620D-D51F-4FCF-821E-AADD36230830}.Release|x86.Build.0 = Release|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Debug|Any CPU.Build.0 = Debug|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Debug|x86.ActiveCfg = Debug|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Debug|x86.Build.0 = Debug|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Release|Any CPU.ActiveCfg = Release|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Release|Any CPU.Build.0 = Release|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Release|x86.ActiveCfg = Release|Any CPU
{043555C4-568F-4ECD-B064-6C3DC1EA3124}.Release|x86.Build.0 = Release|Any CPU
{44C8FB68-8EB3-4872-8163-3370239215F9}.Debug|Any CPU.ActiveCfg = Debug|x86
{44C8FB68-8EB3-4872-8163-3370239215F9}.Debug|x86.ActiveCfg = Debug|x86
{44C8FB68-8EB3-4872-8163-3370239215F9}.Debug|x86.Build.0 = Debug|x86
{44C8FB68-8EB3-4872-8163-3370239215F9}.Release|Any CPU.ActiveCfg = Release|x86
{44C8FB68-8EB3-4872-8163-3370239215F9}.Release|Any CPU.Build.0 = Release|x86
{44C8FB68-8EB3-4872-8163-3370239215F9}.Release|x86.ActiveCfg = Release|x86
{44C8FB68-8EB3-4872-8163-3370239215F9}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F2FFC432-ACBD-4672-B19D-A030BA8B85F2}
EndGlobalSection
EndGlobal
27 changes: 27 additions & 0 deletions src/HuntAndPeck/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="HuntAndPeck.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<HuntAndPeck.Properties.Settings>
<setting name="myModifiers" serializeAs="String">
<value>Alt</value>
</setting>
<setting name="myTaskbarModifiers" serializeAs="String">
<value>Control</value>
</setting>
<setting name="myDebugModifiers" serializeAs="String">
<value>Alt, Shift</value>
</setting>
<setting name="myTaskbarHotkey" serializeAs="String">
<value>Oem1</value>
</setting>
<setting name="myDebugHotkey" serializeAs="String">
<value>Oem1</value>
</setting>
<setting name="myHotkey" serializeAs="String">
<value>Oem1</value>
</setting>
</HuntAndPeck.Properties.Settings>
</userSettings>
</configuration>
29 changes: 16 additions & 13 deletions src/HuntAndPeck/HuntAndPeck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D9A0620D-D51F-4FCF-821E-AADD36230830}</ProjectGuid>
<OutputType>WinExe</OutputType>
Expand All @@ -15,6 +16,7 @@
<WarningLevel>4</WarningLevel>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -27,7 +29,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down Expand Up @@ -58,6 +59,7 @@
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net45\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
Expand Down Expand Up @@ -95,6 +97,16 @@
<Compile Include="Models\UiAutomationInvokeHint.cs" />
<Compile Include="Models\UiAutomationSelectHint.cs" />
<Compile Include="Models\UiAutomationToggleHint.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Services\HintLabelService.cs" />
<Compile Include="Services\Interfaces\IDebugHintProviderService.cs" />
<Compile Include="Services\Interfaces\IHintLabelService.cs" />
Expand All @@ -105,6 +117,7 @@
</Compile>
<Compile Include="Services\UiAutomationPatternIds.cs" />
<Compile Include="Services\UiAutomationHintProviderService.cs" />
<Compile Include="Settings.cs" />
<Compile Include="SingleLaunchMutex.cs" />
<Compile Include="ViewModels\DebugHintViewModel.cs" />
<Compile Include="ViewModels\DebugOverlayViewModel.cs" />
Expand Down Expand Up @@ -132,18 +145,9 @@
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
Expand Down Expand Up @@ -231,8 +235,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PreBuildEvent>taskkill /f /fi "pid gt 0" /im hap.exe</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
1 change: 0 additions & 1 deletion src/HuntAndPeck/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
Expand Down
2 changes: 1 addition & 1 deletion src/HuntAndPeck/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 72 additions & 1 deletion src/HuntAndPeck/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 22 additions & 5 deletions src/HuntAndPeck/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="HuntAndPeck.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="myModifiers" Type="HuntAndPeck.NativeMethods.KeyModifier" Scope="User">
<Value Profile="(Default)">Alt</Value>
</Setting>
<Setting Name="myTaskbarModifiers" Type="HuntAndPeck.NativeMethods.KeyModifier" Scope="User">
<Value Profile="(Default)">Control</Value>
</Setting>
<Setting Name="myDebugModifiers" Type="HuntAndPeck.NativeMethods.KeyModifier" Scope="User">
<Value Profile="(Default)">Alt, Shift</Value>
</Setting>
<Setting Name="myTaskbarHotkey" Type="System.Windows.Forms.Keys" Scope="User">
<Value Profile="(Default)">Oem1</Value>
</Setting>
<Setting Name="myDebugHotkey" Type="System.Windows.Forms.Keys" Scope="User">
<Value Profile="(Default)">Oem1</Value>
</Setting>
<Setting Name="myHotkey" GenerateDefaultValueInCode="false" Type="System.Windows.Forms.Keys" Scope="User">
<Value Profile="(Default)">Oem1</Value>
</Setting>
</Settings>
</SettingsFile>
4 changes: 2 additions & 2 deletions src/HuntAndPeck/Services/HintLabelService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public IList<string> GetHintStrings(int hintCount)
{
return hintStrings;
}

var hintCharacters = new[] { 'S', 'A', 'D', 'F', 'J', 'K', 'L', 'E', 'W', 'C', 'M', 'P', 'G', 'H' };
var hintCharacters = new[] { 'S', 'A', 'D', 'F', 'J', 'K', 'L', 'E', 'I', 'B', 'W', 'O', 'T', 'U', 'Y', 'R', 'Q', 'C', 'V', 'N', 'C', 'M', 'P', 'G', 'H', 'X', 'Z' }; // #todo consider adding []\;',./`
var digitsNeeded = (int)Math.Ceiling(Math.Log(hintCount) / Math.Log(hintCharacters.Length));

var wholeHintCount = (int)Math.Pow(hintCharacters.Length, digitsNeeded);
Expand Down
28 changes: 28 additions & 0 deletions src/HuntAndPeck/Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace HuntAndPeck.Properties {


// This class allows you to handle specific events on the settings class:
// The SettingChanging event is raised before a setting's value is changed.
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {

public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:
//
this.SettingChanging += this.SettingChangingEventHandler;
//
this.SettingsSaving += this.SettingsSavingEventHandler;
//
}

private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
// Add code to handle the SettingChangingEvent event here.
}

private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
// Add code to handle the SettingsSaving event here.
}
}
}
Loading