├── .gitignore
├── Configurator
├── .gitignore
├── Configurator.exe
├── packages.config
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── Configurator.sln
├── app.manifest
├── Configurator.csproj
├── Configurator.Designer.cs
├── Configurator.cs
└── Configurator.resx
├── App.config
├── auto_hot_key_solution.ahk
├── Properties
├── Settings.settings
├── Settings.Designer.cs
├── AssemblyInfo.cs
├── Resources.Designer.cs
└── Resources.resx
├── LICENSE
├── README.zh.md
├── README.md
├── app.manifest
├── ListaryWithWinKey.csproj
└── Program.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | obj/
--------------------------------------------------------------------------------
/Configurator/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | obj/
3 | .vs/
4 |
--------------------------------------------------------------------------------
/Configurator/Configurator.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/KevinWang15/ListaryWithWinKey/HEAD/Configurator/Configurator.exe
--------------------------------------------------------------------------------
/Configurator/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Configurator/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/auto_hot_key_solution.ahk:
--------------------------------------------------------------------------------
1 | ; Install AutoHotkey from https://autohotkey.com/download/
2 |
3 | ~LWin Up::
4 | {
5 | sleep 100
6 | Send {ESC}
7 | sleep 50
8 | Send {Ctrl}
9 | sleep 50
10 | Send {Ctrl}
11 | }
12 |
--------------------------------------------------------------------------------
/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Configurator/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Configurator/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace Configurator
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Configurator());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Configurator/Configurator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configurator", "Configurator.csproj", "{09EEEEDD-42A2-40F7-A322-D4300269CC1E}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {09EEEEDD-42A2-40F7-A322-D4300269CC1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {09EEEEDD-42A2-40F7-A322-D4300269CC1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {09EEEEDD-42A2-40F7-A322-D4300269CC1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {09EEEEDD-42A2-40F7-A322-D4300269CC1E}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Scott Hanselman
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ListaryWithWinKey.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Configurator/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Configurator.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/README.zh.md:
--------------------------------------------------------------------------------
1 | # 使用Win键打开[Listary](http://www.listary.com/)
2 | [Listary](http://www.listary.com/) 类似Mac中的Spotlight,是一款很强的Windows下的搜索与快速打开工具。
3 |
4 | 但是它的默认快捷键Ctrl+Ctrl却不那么方便,有时这个快捷键会被误触,而且对于习惯按Win然后打字来搜索的人来说,这不太符合习惯。软件本身并没有使用Win作为快捷键的功能,所以我用C#写了个小程序提供这个功能。
5 |
6 | 这个程序实质上是把Win映射为打开Listary的快捷键。映射是在Win松开的时候进行的,所以不会影响别的快捷键,比如Win+D。这个程序使用了一个键盘钩子所以可能会被杀毒软件误报,以及它需要管理员权限。但这是一个只有一百多行的开源程序,所以你们可以检查代码,绝对安全。
7 |
8 | # 下载
9 | https://github.com/KevinWang15/ListaryWithWinKey/releases
10 |
11 | # 如何使用
12 | 1. 安装并运行[Listary](http://www.listary.com/)。
13 | 2. 设置Listary, 在```快捷键```中,你可以选择禁用掉```按下Ctrl两次以显示/隐藏Listary```(如果你经常误触)。
14 | 3. 在```快捷键```中, 把```显示 Listary 工具条```快捷键设置为Ctrl+Shift+Alt+Win+F. (五个键同时按) (这保证了这个快捷键不会和别的快捷键冲突,所以把Win映射过去不会有任何副作用。如果你不喜欢这个快捷键,你可以[修改代码](https://github.com/KevinWang15/ListaryWithWinKey/blob/master/Program.cs#L44-L57))。
15 | 4. 用管理员权限运行程序```ListaryWithWinKey.exe```(双击后会自动索要管理员权限)。
16 | 5. 按Win打开工具条。
17 | 6. 再按一次Win关闭工具条。
18 |
19 | # 如何禁用此功能
20 | 运行```Configurator.exe```并点击```Stop```。
21 |
22 | # 如何开机启用
23 | 运行```Configurator.exe```并在```Start on boot```中点击```Enable```。
24 |
25 | # 特别感谢
26 | https://github.com/shanselman/babysmash/blob/master/KeyboardHook.cs
27 |
--------------------------------------------------------------------------------
/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ListaryWithWinKey")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ListaryWithWinKey")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("928fe324-f54c-47af-9117-1df5b9ba54c7")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.1.0.0")]
36 | [assembly: AssemblyFileVersion("1.1.0.0")]
37 |
--------------------------------------------------------------------------------
/Configurator/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Configurator")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Configurator")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("09eeeedd-42a2-40f7-a322-d4300269cc1e")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Start [Listary](http://www.listary.com/) with Win key only
2 | [Listary](http://www.listary.com/) is a powerful search utility for windows, similar to spotlight in Mac.
3 |
4 | It's a great software, but for people like me who are used to windows search (press Win and then type), listary's default shortcut Ctrl+Ctrl can be a little clumsy and it takes some time to get used to it. The software itself doesn't offer a way to set the shortcut to Win and replace the original windows menu, so I wrote a C# program to make it happen.
5 |
6 | It's essentially a program that remaps Win to a hotkey that shows Listary toolbar, the remapping happens after Win is released so it doesn't interferes with other Win-related hotkeys such as Win+D.
7 |
8 | It uses a keyboard hook, so it may be reported by anti-virus software, and it requires administrator privileges, but it is an open-source software with only 100+ lines of code, so you can check the source code and be assured that it does nothing harmful.
9 |
10 | # Download
11 | https://github.com/KevinWang15/ListaryWithWinKey/releases
12 |
13 | # How to use
14 | 1. Install and run [Listary](http://www.listary.com/).
15 | 2. Configure Listary, in ```Hotkeys```, optionally disable ```Press Ctrl twice to show/hide Listary``` (if you trigger it by mistake sometimes and hate it).
16 | 3. In ```Hotkeys```, configure ```Show Listary toolbar``` to Ctrl+Shift+Alt+Win+F. (press all five keys at the same time) (this is to make sure it doesn't conflict with other hotkeys, so that remapping Win to this hotkey will not have any side effect. If you don't like this shortcut, you can [modify the code.](https://github.com/KevinWang15/ListaryWithWinKey/blob/master/Program.cs#L44-L57))
17 | 4. Run the program ```ListaryWithWinKey.exe``` as Administrator (double click and it will ask for administrator privilege).
18 | 5. Press Win to open the launcher.
19 | 6. Press Win again to close it.
20 |
21 | # How to disable it
22 | Run ```Configurator.exe``` and click ```Stop```.
23 |
24 | # How to make it start on boot
25 | Run ```Configurator.exe``` and click ```Enable``` on ```Start on boot```.
26 |
27 | # Current state of the program
28 | Tested on Windows 10 and it is working fine. More tests are needed. It is more a proof-of-concept than a reliable software. I also wish the devs of listary could see it and integrate the idea/code into their official release.
29 |
30 | Pull requests and Issues are welcome.
31 |
32 | # Special Thanks to
33 | https://github.com/shanselman/babysmash/blob/master/KeyboardHook.cs
34 |
--------------------------------------------------------------------------------
/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ListaryWithWinKey.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ListaryWithWinKey.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Configurator/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Configurator.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Configurator.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
59 |
60 |
61 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/Configurator/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
59 |
60 |
61 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/Configurator/Configurator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {09EEEEDD-42A2-40F7-A322-D4300269CC1E}
8 | WinExe
9 | Properties
10 | Configurator
11 | Configurator
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 | app.manifest
37 |
38 |
39 |
40 | packages\TaskScheduler.2.5.22\lib\net452\Microsoft.Win32.TaskScheduler.dll
41 | True
42 | False
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Form
59 |
60 |
61 | Configurator.cs
62 |
63 |
64 |
65 |
66 | Configurator.cs
67 |
68 |
69 | ResXFileCodeGenerator
70 | Resources.Designer.cs
71 | Designer
72 |
73 |
74 | True
75 | Resources.resx
76 |
77 |
78 |
79 |
80 | SettingsSingleFileGenerator
81 | Settings.Designer.cs
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
103 |
--------------------------------------------------------------------------------
/Configurator/Configurator.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Configurator
2 | {
3 | partial class Configurator
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | this.start_on_boot_button = new System.Windows.Forms.Button();
33 | this.running_text = new System.Windows.Forms.Label();
34 | this.start_on_boot_text = new System.Windows.Forms.Label();
35 | this.running_button = new System.Windows.Forms.Button();
36 | this.layout_refresher = new System.Windows.Forms.Timer(this.components);
37 | this.SuspendLayout();
38 | //
39 | // start_on_boot_button
40 | //
41 | this.start_on_boot_button.Location = new System.Drawing.Point(107, 51);
42 | this.start_on_boot_button.Name = "start_on_boot_button";
43 | this.start_on_boot_button.Size = new System.Drawing.Size(122, 31);
44 | this.start_on_boot_button.TabIndex = 0;
45 | this.start_on_boot_button.TabStop = false;
46 | this.start_on_boot_button.UseVisualStyleBackColor = true;
47 | this.start_on_boot_button.Click += new System.EventHandler(this.start_on_boot_button_Click);
48 | //
49 | // running_text
50 | //
51 | this.running_text.AutoSize = true;
52 | this.running_text.Location = new System.Drawing.Point(9, 18);
53 | this.running_text.Name = "running_text";
54 | this.running_text.Size = new System.Drawing.Size(53, 13);
55 | this.running_text.TabIndex = 1;
56 | this.running_text.Text = "Running: ";
57 | //
58 | // start_on_boot_text
59 | //
60 | this.start_on_boot_text.AutoSize = true;
61 | this.start_on_boot_text.Location = new System.Drawing.Point(9, 60);
62 | this.start_on_boot_text.Name = "start_on_boot_text";
63 | this.start_on_boot_text.Size = new System.Drawing.Size(74, 13);
64 | this.start_on_boot_text.TabIndex = 2;
65 | this.start_on_boot_text.Text = "Start on boot: ";
66 | //
67 | // running_button
68 | //
69 | this.running_button.Location = new System.Drawing.Point(107, 9);
70 | this.running_button.Name = "running_button";
71 | this.running_button.Size = new System.Drawing.Size(122, 31);
72 | this.running_button.TabIndex = 3;
73 | this.running_button.TabStop = false;
74 | this.running_button.UseVisualStyleBackColor = true;
75 | this.running_button.Click += new System.EventHandler(this.running_button_Click);
76 | //
77 | // layout_refresher
78 | //
79 | this.layout_refresher.Enabled = true;
80 | this.layout_refresher.Interval = 3000;
81 | this.layout_refresher.Tick += new System.EventHandler(this.layout_refresher_Tick);
82 | //
83 | // Configurator
84 | //
85 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
86 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
87 | this.ClientSize = new System.Drawing.Size(245, 93);
88 | this.Controls.Add(this.running_button);
89 | this.Controls.Add(this.start_on_boot_text);
90 | this.Controls.Add(this.running_text);
91 | this.Controls.Add(this.start_on_boot_button);
92 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
93 | this.MaximizeBox = false;
94 | this.Name = "Configurator";
95 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
96 | this.Text = "Configurator";
97 | this.Load += new System.EventHandler(this.Configurator_Load);
98 | this.ResumeLayout(false);
99 | this.PerformLayout();
100 |
101 | }
102 |
103 | #endregion
104 |
105 | private System.Windows.Forms.Button start_on_boot_button;
106 | private System.Windows.Forms.Label running_text;
107 | private System.Windows.Forms.Label start_on_boot_text;
108 | private System.Windows.Forms.Button running_button;
109 | private System.Windows.Forms.Timer layout_refresher;
110 | }
111 | }
112 |
113 |
--------------------------------------------------------------------------------
/ListaryWithWinKey.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {928FE324-F54C-47AF-9117-1DF5B9BA54C7}
8 | WinExe
9 | Properties
10 | ListaryWithWinKey
11 | ListaryWithWinKey
12 | v4.5.2
13 | 512
14 | true
15 | false
16 | publish\
17 | true
18 | Disk
19 | false
20 | Foreground
21 | 7
22 | Days
23 | false
24 | false
25 | true
26 | 0
27 | 1.1.0.%2a
28 | false
29 | true
30 |
31 |
32 | AnyCPU
33 | true
34 | full
35 | false
36 | bin\Debug\
37 | DEBUG;TRACE
38 | prompt
39 | 4
40 |
41 |
42 | AnyCPU
43 | pdbonly
44 | true
45 | bin\Release\
46 | TRACE
47 | prompt
48 | 4
49 |
50 |
51 | app.manifest
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | ResXFileCodeGenerator
71 | Resources.Designer.cs
72 | Designer
73 |
74 |
75 | True
76 | Resources.resx
77 |
78 |
79 |
80 | SettingsSingleFileGenerator
81 | Settings.Designer.cs
82 |
83 |
84 | True
85 | Settings.settings
86 | True
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | False
98 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29
99 | true
100 |
101 |
102 | False
103 | .NET Framework 3.5 SP1
104 | false
105 |
106 |
107 |
108 |
115 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 | using System.Runtime.InteropServices;
4 | using System.Diagnostics;
5 | using WinForms = System.Windows.Forms;
6 | using System.Threading;
7 |
8 |
9 | namespace ListaryWithWinKey
10 | {
11 | static class Program
12 | {
13 | private static readonly InterceptKeys.LowLevelKeyboardProc _proc = HookCallback;
14 | private static IntPtr _hookID = IntPtr.Zero;
15 | private const int KEYEVENTF_EXTENDEDKEY = 0x1;
16 | private const int KEYEVENTF_KEYUP = 0x2;
17 | private const int WM_KEYDOWN = 0x0100;
18 | private const int WM_KEYUP = 0x0101;
19 |
20 | private static bool otherKeyPressed = false;
21 | public static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
22 | {
23 | if (nCode >= 0)
24 | {
25 | bool alt = (WinForms.Control.ModifierKeys & Keys.Alt) != 0;
26 | bool control = (WinForms.Control.ModifierKeys & Keys.Control) != 0;
27 |
28 | int vkCode = Marshal.ReadInt32(lParam);
29 | Keys key = (Keys)vkCode;
30 |
31 | if (key == System.Windows.Forms.Keys.LWin)
32 | {
33 | if ((int)wParam == WM_KEYDOWN)
34 | otherKeyPressed = false;
35 |
36 | if ((int)wParam == WM_KEYUP)
37 | {
38 | if (otherKeyPressed)
39 | {
40 | // A win key hotkey, do nothing
41 | }
42 | else
43 | {
44 | // Call listary with Ctrl+Shift+Alt+Win+F!
45 | (new Thread(() => {
46 | keybd_event((int)System.Windows.Forms.Keys.LControlKey, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
47 | keybd_event((int)System.Windows.Forms.Keys.LShiftKey, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
48 | keybd_event((int)System.Windows.Forms.Keys.LMenu, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
49 | keybd_event((int)System.Windows.Forms.Keys.LWin, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
50 | keybd_event((int)System.Windows.Forms.Keys.F, 0x45, KEYEVENTF_EXTENDEDKEY, 0);
51 | keybd_event((int)System.Windows.Forms.Keys.F, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
52 | keybd_event((int)System.Windows.Forms.Keys.LWin, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
53 | keybd_event((int)System.Windows.Forms.Keys.LMenu, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
54 | keybd_event((int)System.Windows.Forms.Keys.LShiftKey, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
55 | keybd_event((int)System.Windows.Forms.Keys.LControlKey, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
56 | })).Start();
57 |
58 | return (IntPtr)1;
59 | }
60 | }
61 | }
62 | else
63 | {
64 | otherKeyPressed = true;
65 | }
66 | }
67 |
68 | return InterceptKeys.CallNextHookEx(_hookID, nCode, wParam, lParam);
69 | }
70 |
71 | [DllImport("user32.dll")]
72 | static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
73 |
74 | private static void DetachKeyboardHook()
75 | {
76 | if (_hookID != IntPtr.Zero)
77 | InterceptKeys.UnhookWindowsHookEx(_hookID);
78 | }
79 |
80 | [STAThread]
81 | static void Main()
82 | {
83 | try
84 | {
85 | _hookID = InterceptKeys.SetHook(_proc);
86 | }
87 | catch
88 | {
89 | DetachKeyboardHook();
90 | }
91 |
92 | Application.Run();
93 | }
94 | }
95 |
96 | internal class InterceptKeys
97 | {
98 | #region Delegates
99 |
100 | public delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
101 |
102 | #endregion
103 |
104 | private const int WH_KEYBOARD_LL = 13;
105 | private const int WM_KEYDOWN = 0x0100;
106 |
107 | public static IntPtr SetHook(LowLevelKeyboardProc proc)
108 | {
109 | using (Process curProcess = Process.GetCurrentProcess())
110 | using (ProcessModule curModule = curProcess.MainModule)
111 | {
112 | return SetWindowsHookEx(WH_KEYBOARD_LL, proc, GetModuleHandle(curModule.ModuleName), 0);
113 | }
114 | }
115 |
116 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
117 | private static extern IntPtr SetWindowsHookEx(int idHook,
118 | LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
119 |
120 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
121 | [return: MarshalAs(UnmanagedType.Bool)]
122 | public static extern bool UnhookWindowsHookEx(IntPtr hhk);
123 |
124 | [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
125 | public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,
126 | IntPtr wParam, IntPtr lParam);
127 |
128 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
129 | private static extern IntPtr GetModuleHandle(string lpModuleName);
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Configurator/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Configurator/Configurator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Diagnostics;
11 | using System.Threading;
12 | using System.IO;
13 | using Microsoft.Win32.TaskScheduler;
14 |
15 | namespace Configurator
16 | {
17 | public partial class Configurator : Form
18 | {
19 | public bool isRunning()
20 | {
21 | Process[] pname = Process.GetProcessesByName("ListaryWithWinKey");
22 | return pname.Length > 0;
23 | }
24 |
25 | public bool isStartOnBoot()
26 | {
27 | using (TaskService ts = new TaskService())
28 | {
29 | Microsoft.Win32.TaskScheduler.Task task = ts.FindTask("ListaryWithWinKey", false);
30 | return task != null;
31 |
32 | }
33 | }
34 |
35 | public void setLayout()
36 | {
37 | if (running_button.Enabled)
38 | {
39 | if (isRunning())
40 | {
41 | this.running_text.Text = "Running: Yes";
42 | this.running_button.Text = "Stop";
43 | }
44 | else
45 | {
46 | this.running_text.Text = "Running: No";
47 | this.running_button.Text = "Run";
48 | }
49 | }
50 | if (isStartOnBoot())
51 | {
52 | this.start_on_boot_text.Text = "Start on boot: Yes";
53 | this.start_on_boot_button.Text = "Disable";
54 | }
55 | else
56 | {
57 | this.start_on_boot_text.Text = "Start on boot: No";
58 | this.start_on_boot_button.Text = "Enable";
59 | }
60 | }
61 |
62 | public Configurator()
63 | {
64 | InitializeComponent();
65 | Control.CheckForIllegalCrossThreadCalls = false;
66 | }
67 |
68 | private void Configurator_Load(object sender, EventArgs e)
69 | {
70 | setLayout();
71 | }
72 |
73 | private void running_button_Click(object sender, EventArgs e)
74 | {
75 | running_button.Enabled = false;
76 | if (isRunning())
77 | {
78 | Process[] processes = Process.GetProcessesByName("ListaryWithWinKey");
79 | for (int i = 0; i < processes.Length; i++)
80 | {
81 | try
82 | {
83 | processes[i].Kill();
84 | }
85 | catch (Exception ex)
86 | {
87 | MessageBox.Show("Unable to terminate ListaryWithWinKey.exe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
88 | }
89 | }
90 | }
91 | else
92 | {
93 | if (!File.Exists("ListaryWithWinKey.exe"))
94 | {
95 | MessageBox.Show("ListaryWithWinKey.exe not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
96 | running_button.Enabled = true;
97 | return;
98 | }
99 | try
100 | {
101 | Process.Start("ListaryWithWinKey.exe");
102 | }
103 | catch (Exception ex)
104 | {
105 | MessageBox.Show("Process start failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
106 | running_button.Enabled = true;
107 | return;
108 | }
109 | }
110 | new Thread(() =>
111 | {
112 | Thread.Sleep(1000);
113 | this.Invoke((MethodInvoker)delegate ()
114 | {
115 | running_button.Enabled = true;
116 | });
117 | setLayout();
118 | }).Start();
119 | }
120 |
121 | private void layout_refresher_Tick(object sender, EventArgs e)
122 | {
123 | setLayout();
124 | }
125 |
126 | private void start_on_boot_button_Click(object sender, EventArgs e)
127 | {
128 | if (isStartOnBoot())
129 | {
130 | using (TaskService ts = new TaskService())
131 | {
132 | Microsoft.Win32.TaskScheduler.Task task = ts.FindTask("ListaryWithWinKey");
133 | if (task != null)
134 | {
135 | ts.RootFolder.DeleteTask("ListaryWithWinKey");
136 | }
137 | }
138 | }
139 | else
140 | {
141 | var exePath = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "ListaryWithWinKey.exe");
142 | if (!File.Exists(exePath))
143 | {
144 | MessageBox.Show("ListaryWithWinKey.exe not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
145 | return;
146 | }
147 |
148 | using (TaskService ts = new TaskService())
149 | {
150 | TaskDefinition td = ts.NewTask();
151 | td.RegistrationInfo.Description = "ListaryWithWinKey";
152 | td.Triggers.Add(new LogonTrigger());
153 | td.Settings.DisallowStartIfOnBatteries = false;
154 | td.Settings.StopIfGoingOnBatteries = false;
155 | td.Settings.ExecutionTimeLimit = TimeSpan.Zero;
156 | td.Principal.RunLevel = TaskRunLevel.Highest;
157 | td.Actions.Add(new ExecAction(exePath, "", null));
158 | ts.RootFolder.RegisterTaskDefinition("ListaryWithWinKey", td);
159 | }
160 | }
161 | setLayout();
162 | }
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/Configurator/Configurator.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
--------------------------------------------------------------------------------