├── .gitignore
├── LICENSE
├── MicHotkey.sln
├── MicHotkey
├── App.config
├── FodyWeavers.xml
├── KeyboardHook.cs
├── MainForm.Designer.cs
├── MainForm.cs
├── MainForm.resx
├── MicHotkey.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── green.ico
│ └── red.ico
├── beep300.wav
├── beep750.wav
├── green.ico
├── green.png
├── mixed.ico
├── mixed.png
├── red.ico
└── red.png
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.vspscc
94 | *.vssscc
95 | .builds
96 | *.pidb
97 | *.svclog
98 | *.scc
99 |
100 | # Chutzpah Test files
101 | _Chutzpah*
102 |
103 | # Visual C++ cache files
104 | ipch/
105 | *.aps
106 | *.ncb
107 | *.opendb
108 | *.opensdf
109 | *.sdf
110 | *.cachefile
111 | *.VC.db
112 | *.VC.VC.opendb
113 |
114 | # Visual Studio profiler
115 | *.psess
116 | *.vsp
117 | *.vspx
118 | *.sap
119 |
120 | # Visual Studio Trace Files
121 | *.e2e
122 |
123 | # TFS 2012 Local Workspace
124 | $tf/
125 |
126 | # Guidance Automation Toolkit
127 | *.gpState
128 |
129 | # ReSharper is a .NET coding add-in
130 | _ReSharper*/
131 | *.[Rr]e[Ss]harper
132 | *.DotSettings.user
133 |
134 | # TeamCity is a build add-in
135 | _TeamCity*
136 |
137 | # DotCover is a Code Coverage Tool
138 | *.dotCover
139 |
140 | # AxoCover is a Code Coverage Tool
141 | .axoCover/*
142 | !.axoCover/settings.json
143 |
144 | # Coverlet is a free, cross platform Code Coverage Tool
145 | coverage*.json
146 | coverage*.xml
147 | coverage*.info
148 |
149 | # Visual Studio code coverage results
150 | *.coverage
151 | *.coveragexml
152 |
153 | # NCrunch
154 | _NCrunch_*
155 | .*crunch*.local.xml
156 | nCrunchTemp_*
157 |
158 | # MightyMoose
159 | *.mm.*
160 | AutoTest.Net/
161 |
162 | # Web workbench (sass)
163 | .sass-cache/
164 |
165 | # Installshield output folder
166 | [Ee]xpress/
167 |
168 | # DocProject is a documentation generator add-in
169 | DocProject/buildhelp/
170 | DocProject/Help/*.HxT
171 | DocProject/Help/*.HxC
172 | DocProject/Help/*.hhc
173 | DocProject/Help/*.hhk
174 | DocProject/Help/*.hhp
175 | DocProject/Help/Html2
176 | DocProject/Help/html
177 |
178 | # Click-Once directory
179 | publish/
180 |
181 | # Publish Web Output
182 | *.[Pp]ublish.xml
183 | *.azurePubxml
184 | # Note: Comment the next line if you want to checkin your web deploy settings,
185 | # but database connection strings (with potential passwords) will be unencrypted
186 | *.pubxml
187 | *.publishproj
188 |
189 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
190 | # checkin your Azure Web App publish settings, but sensitive information contained
191 | # in these scripts will be unencrypted
192 | PublishScripts/
193 |
194 | # NuGet Packages
195 | *.nupkg
196 | # NuGet Symbol Packages
197 | *.snupkg
198 | # The packages folder can be ignored because of Package Restore
199 | **/[Pp]ackages/*
200 | # except build/, which is used as an MSBuild target.
201 | !**/[Pp]ackages/build/
202 | # Uncomment if necessary however generally it will be regenerated when needed
203 | #!**/[Pp]ackages/repositories.config
204 | # NuGet v3's project.json files produces more ignorable files
205 | *.nuget.props
206 | *.nuget.targets
207 |
208 | # Microsoft Azure Build Output
209 | csx/
210 | *.build.csdef
211 |
212 | # Microsoft Azure Emulator
213 | ecf/
214 | rcf/
215 |
216 | # Windows Store app package directories and files
217 | AppPackages/
218 | BundleArtifacts/
219 | Package.StoreAssociation.xml
220 | _pkginfo.txt
221 | *.appx
222 | *.appxbundle
223 | *.appxupload
224 |
225 | # Visual Studio cache files
226 | # files ending in .cache can be ignored
227 | *.[Cc]ache
228 | # but keep track of directories ending in .cache
229 | !?*.[Cc]ache/
230 |
231 | # Others
232 | ClientBin/
233 | ~$*
234 | *~
235 | *.dbmdl
236 | *.dbproj.schemaview
237 | *.jfm
238 | *.pfx
239 | *.publishsettings
240 | orleans.codegen.cs
241 |
242 | # Including strong name files can present a security risk
243 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
244 | #*.snk
245 |
246 | # Since there are multiple workflows, uncomment next line to ignore bower_components
247 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
248 | #bower_components/
249 |
250 | # RIA/Silverlight projects
251 | Generated_Code/
252 |
253 | # Backup & report files from converting an old project file
254 | # to a newer Visual Studio version. Backup files are not needed,
255 | # because we have git ;-)
256 | _UpgradeReport_Files/
257 | Backup*/
258 | UpgradeLog*.XML
259 | UpgradeLog*.htm
260 | ServiceFabricBackup/
261 | *.rptproj.bak
262 |
263 | # SQL Server files
264 | *.mdf
265 | *.ldf
266 | *.ndf
267 |
268 | # Business Intelligence projects
269 | *.rdl.data
270 | *.bim.layout
271 | *.bim_*.settings
272 | *.rptproj.rsuser
273 | *- [Bb]ackup.rdl
274 | *- [Bb]ackup ([0-9]).rdl
275 | *- [Bb]ackup ([0-9][0-9]).rdl
276 |
277 | # Microsoft Fakes
278 | FakesAssemblies/
279 |
280 | # GhostDoc plugin setting file
281 | *.GhostDoc.xml
282 |
283 | # Node.js Tools for Visual Studio
284 | .ntvs_analysis.dat
285 | node_modules/
286 |
287 | # Visual Studio 6 build log
288 | *.plg
289 |
290 | # Visual Studio 6 workspace options file
291 | *.opt
292 |
293 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
294 | *.vbw
295 |
296 | # Visual Studio LightSwitch build output
297 | **/*.HTMLClient/GeneratedArtifacts
298 | **/*.DesktopClient/GeneratedArtifacts
299 | **/*.DesktopClient/ModelManifest.xml
300 | **/*.Server/GeneratedArtifacts
301 | **/*.Server/ModelManifest.xml
302 | _Pvt_Extensions
303 |
304 | # Paket dependency manager
305 | .paket/paket.exe
306 | paket-files/
307 |
308 | # FAKE - F# Make
309 | .fake/
310 |
311 | # CodeRush personal settings
312 | .cr/personal
313 |
314 | # Python Tools for Visual Studio (PTVS)
315 | __pycache__/
316 | *.pyc
317 |
318 | # Cake - Uncomment if you are using it
319 | # tools/**
320 | # !tools/packages.config
321 |
322 | # Tabs Studio
323 | *.tss
324 |
325 | # Telerik's JustMock configuration file
326 | *.jmconfig
327 |
328 | # BizTalk build output
329 | *.btp.cs
330 | *.btm.cs
331 | *.odx.cs
332 | *.xsd.cs
333 |
334 | # OpenCover UI analysis results
335 | OpenCover/
336 |
337 | # Azure Stream Analytics local run output
338 | ASALocalRun/
339 |
340 | # MSBuild Binary and Structured Log
341 | *.binlog
342 |
343 | # NVidia Nsight GPU debugger configuration file
344 | *.nvuser
345 |
346 | # MFractors (Xamarin productivity tool) working folder
347 | .mfractor/
348 |
349 | # Local History for Visual Studio
350 | .localhistory/
351 |
352 | # BeatPulse healthcheck temp database
353 | healthchecksdb
354 |
355 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
356 | MigrationBackup/
357 |
358 | # Ionide (cross platform F# VS Code tools) working folder
359 | .ionide/
360 |
361 | # Fody - auto-generated XML schema
362 | FodyWeavers.xsd
363 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Wouter
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 |
--------------------------------------------------------------------------------
/MicHotkey.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30128.74
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicHotkey", "MicHotkey\MicHotkey.csproj", "{01EB6A64-2168-4C6A-A3C4-181A58D2DFCB}"
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 | {01EB6A64-2168-4C6A-A3C4-181A58D2DFCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {01EB6A64-2168-4C6A-A3C4-181A58D2DFCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {01EB6A64-2168-4C6A-A3C4-181A58D2DFCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {01EB6A64-2168-4C6A-A3C4-181A58D2DFCB}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {EEC8F9E4-3AA4-47AD-A637-EEACAD6F5A71}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/MicHotkey/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 0
15 |
16 |
17 | F24
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MicHotkey/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/MicHotkey/KeyboardHook.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Linq;
5 | using System.Runtime.InteropServices;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 |
10 | namespace MicHotkey
11 | {
12 | public sealed class KeyboardHook : IDisposable
13 | {
14 | // Registers a hot key with Windows.
15 | [DllImport("user32.dll")]
16 | private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
17 | // Unregisters the hot key with Windows.
18 | [DllImport("user32.dll")]
19 | private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
20 |
21 | ///
22 | /// Represents the window that is used internally to get the messages.
23 | ///
24 | private class Window : NativeWindow, IDisposable
25 | {
26 | private static int WM_HOTKEY = 0x0312;
27 |
28 | public Window() {
29 | // create the handle for the window.
30 | this.CreateHandle(new CreateParams());
31 | }
32 |
33 | ///
34 | /// Overridden to get the notifications.
35 | ///
36 | ///
37 | protected override void WndProc(ref Message m) {
38 | base.WndProc(ref m);
39 |
40 | // check if we got a hot key pressed.
41 | if (m.Msg == WM_HOTKEY) {
42 | // get the keys.
43 | Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);
44 | ModifierKeys modifier = (ModifierKeys)((int)m.LParam & 0xFFFF);
45 |
46 | // invoke the event to notify the parent.
47 | KeyPressed?.Invoke(this, new KeyPressedEventArgs(modifier, key));
48 | }
49 | }
50 |
51 | public event EventHandler KeyPressed;
52 |
53 | #region IDisposable Members
54 |
55 | public void Dispose() {
56 | this.DestroyHandle();
57 | }
58 |
59 | #endregion
60 | }
61 |
62 | private Window _window = new Window();
63 | private int _currentId;
64 | private List registrations = new List();
65 |
66 | public KeyboardHook() {
67 | // register the event of the inner native window.
68 | _window.KeyPressed += delegate (object sender, KeyPressedEventArgs args)
69 | {
70 | // KeyPressed?.Invoke(this, args);
71 | foreach (var registration in registrations)
72 | {
73 | if (registration.Modifier == args.Modifier && registration.Key == args.Key)
74 | {
75 | registration.action.Invoke();
76 | }
77 | }
78 | };
79 | }
80 |
81 | ///
82 | /// Registers a hot key in the system.
83 | ///
84 | /// The modifiers that are associated with the hot key.
85 | /// The key itself that is associated with the hot key.
86 | public HotkeyRegistration RegisterHotKey(ModifierKeys modifier, Keys key, Action action) {
87 | var id = ++_currentId;
88 |
89 | var registration = new HotkeyRegistration(this, id, modifier, key, action);
90 |
91 | // register the hot key.
92 | if (!RegisterHotKey(_window.Handle, id, (uint)modifier, (uint)key))
93 | throw new InvalidOperationException("Couldn’t register the hot key.");
94 |
95 | registrations.Add(registration);
96 | return registration;
97 | }
98 |
99 | ///
100 | /// Registers a hot key in the system.
101 | ///
102 | /// The key itself that is associated with the hot key.
103 | public HotkeyRegistration RegisterHotKey(Keys key, Action action)
104 | {
105 | return RegisterHotKey(0, key, action);
106 | }
107 |
108 | #region IDisposable Members
109 |
110 | public void Dispose()
111 | {
112 | registrations.RemoveAll(hotkey =>
113 | {
114 | UnregisterHotKey(_window.Handle, hotkey.Id);
115 | return true;
116 | });
117 |
118 | // dispose the inner native window.
119 | _window.Dispose();
120 | }
121 |
122 | #endregion
123 |
124 | public void Unregister(HotkeyRegistration hotkey)
125 | {
126 | UnregisterHotKey(_window.Handle, hotkey.Id);
127 | registrations.Remove(hotkey);
128 | }
129 | }
130 |
131 | public class HotkeyRegistration
132 | {
133 | public readonly int Id;
134 | public readonly ModifierKeys Modifier;
135 | public readonly Keys Key;
136 | private readonly KeyboardHook hook;
137 | internal readonly Action action;
138 |
139 | internal HotkeyRegistration(KeyboardHook hook, int id, ModifierKeys modifier, Keys key, Action action) {
140 | this.hook = hook;
141 | this.Modifier = modifier;
142 | this.Key = key;
143 | this.Id = id;
144 | this.action = action;
145 | }
146 |
147 | public void Unregister() {
148 | hook.Unregister(this);
149 | }
150 | }
151 |
152 | ///
153 | /// Event Args for the event that is fired after the hot key has been pressed.
154 | ///
155 | public class KeyPressedEventArgs : EventArgs
156 | {
157 | private ModifierKeys _modifier;
158 | private Keys _key;
159 |
160 | internal KeyPressedEventArgs(ModifierKeys modifier, Keys key) {
161 | _modifier = modifier;
162 | _key = key;
163 | }
164 |
165 | public ModifierKeys Modifier
166 | {
167 | get { return _modifier; }
168 | }
169 |
170 | public Keys Key
171 | {
172 | get { return _key; }
173 | }
174 | }
175 |
176 | ///
177 | /// The enumeration of possible modifiers.
178 | ///
179 | [Flags]
180 | public enum ModifierKeys : uint
181 | {
182 | Alt = 1,
183 | Control = 2,
184 | Shift = 4,
185 | Win = 8
186 | }
187 | }
188 |
--------------------------------------------------------------------------------
/MicHotkey/MainForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MicHotkey
2 | {
3 | partial class MainForm
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 | if (disposing && (components != null)) {
16 | components.Dispose();
17 | }
18 | base.Dispose(disposing);
19 | }
20 |
21 | #region Windows Form Designer generated code
22 |
23 | ///
24 | /// Required method for Designer support - do not modify
25 | /// the contents of this method with the code editor.
26 | ///
27 | private void InitializeComponent() {
28 | this.components = new System.ComponentModel.Container();
29 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
30 | this.toggleButton = new System.Windows.Forms.Button();
31 | this.button_hotkey = new System.Windows.Forms.Button();
32 | this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
33 | this.label_hotkey = new System.Windows.Forms.Label();
34 | this.timer_update = new System.Windows.Forms.Timer(this.components);
35 | this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
36 | this.tableLayoutPanel1.SuspendLayout();
37 | this.SuspendLayout();
38 | //
39 | // toggleButton
40 | //
41 | this.toggleButton.Location = new System.Drawing.Point(80, 3);
42 | this.toggleButton.Name = "toggleButton";
43 | this.toggleButton.Size = new System.Drawing.Size(75, 23);
44 | this.toggleButton.TabIndex = 0;
45 | this.toggleButton.Text = "Toggle Mic";
46 | this.toggleButton.UseVisualStyleBackColor = true;
47 | this.toggleButton.Click += new System.EventHandler(this.Button1_Click);
48 | //
49 | // button_hotkey
50 | //
51 | this.button_hotkey.Location = new System.Drawing.Point(3, 3);
52 | this.button_hotkey.Name = "button_hotkey";
53 | this.button_hotkey.Size = new System.Drawing.Size(71, 23);
54 | this.button_hotkey.TabIndex = 1;
55 | this.button_hotkey.Text = "Set hotkey";
56 | this.button_hotkey.UseVisualStyleBackColor = true;
57 | this.button_hotkey.Click += new System.EventHandler(this.button_hotkey_Click);
58 | this.button_hotkey.KeyUp += new System.Windows.Forms.KeyEventHandler(this.button2_KeyUp);
59 | this.button_hotkey.Leave += new System.EventHandler(this.button_hotkey_Leave);
60 | //
61 | // tableLayoutPanel1
62 | //
63 | this.tableLayoutPanel1.AutoSize = true;
64 | this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
65 | this.tableLayoutPanel1.ColumnCount = 2;
66 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
67 | this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
68 | this.tableLayoutPanel1.Controls.Add(this.button_hotkey, 0, 0);
69 | this.tableLayoutPanel1.Controls.Add(this.toggleButton, 1, 0);
70 | this.tableLayoutPanel1.Controls.Add(this.label_hotkey, 0, 1);
71 | this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
72 | this.tableLayoutPanel1.Name = "tableLayoutPanel1";
73 | this.tableLayoutPanel1.RowCount = 2;
74 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
75 | this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
76 | this.tableLayoutPanel1.Size = new System.Drawing.Size(158, 42);
77 | this.tableLayoutPanel1.TabIndex = 2;
78 | //
79 | // label_hotkey
80 | //
81 | this.label_hotkey.AutoSize = true;
82 | this.tableLayoutPanel1.SetColumnSpan(this.label_hotkey, 2);
83 | this.label_hotkey.Location = new System.Drawing.Point(3, 29);
84 | this.label_hotkey.Name = "label_hotkey";
85 | this.label_hotkey.Size = new System.Drawing.Size(65, 13);
86 | this.label_hotkey.TabIndex = 2;
87 | this.label_hotkey.Text = "Hotkey: ???";
88 | //
89 | // timer_update
90 | //
91 | this.timer_update.Interval = 1000;
92 | this.timer_update.Tick += new System.EventHandler(this.Timer_update_Tick);
93 | //
94 | // notifyIcon
95 | //
96 | this.notifyIcon.Text = "MicKey";
97 | this.notifyIcon.Visible = true;
98 | this.notifyIcon.Click += new System.EventHandler(this.notifyIcon_Click);
99 | this.notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick);
100 | //
101 | // MainForm
102 | //
103 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
104 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
105 | this.AutoSize = true;
106 | this.ClientSize = new System.Drawing.Size(234, 86);
107 | this.Controls.Add(this.tableLayoutPanel1);
108 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
109 | this.MaximizeBox = false;
110 | this.MinimumSize = new System.Drawing.Size(175, 85);
111 | this.Name = "MainForm";
112 | this.Text = "MicKey";
113 | this.TopMost = true;
114 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
115 | this.Load += new System.EventHandler(this.MainForm_Load);
116 | this.tableLayoutPanel1.ResumeLayout(false);
117 | this.tableLayoutPanel1.PerformLayout();
118 | this.ResumeLayout(false);
119 | this.PerformLayout();
120 |
121 | }
122 |
123 | #endregion
124 |
125 | private System.Windows.Forms.Button toggleButton;
126 | private System.Windows.Forms.Button button_hotkey;
127 | private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
128 | private System.Windows.Forms.Timer timer_update;
129 | private System.Windows.Forms.NotifyIcon notifyIcon;
130 | private System.Windows.Forms.Label label_hotkey;
131 | }
132 | }
133 |
134 |
--------------------------------------------------------------------------------
/MicHotkey/MainForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Media;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using AudioSwitcher.AudioApi;
11 | using AudioSwitcher.AudioApi.CoreAudio;
12 | using Microsoft.WindowsAPICodePack.Taskbar;
13 |
14 | namespace MicHotkey
15 | {
16 | public partial class MainForm : Form
17 | {
18 | private CoreAudioController audioController = new CoreAudioController();
19 | private KeyboardHook hook = new KeyboardHook();
20 | private bool wantMute;
21 | private HotkeyRegistration _hotkeyRegistration;
22 | private bool updateHotkey;
23 | private ContextMenu contextMenu;
24 | private MenuItem menuItem1;
25 | private SoundPlayer sound;
26 | private bool firstStart;
27 | private bool enableSound;
28 |
29 | public MainForm()
30 | {
31 | // Hacky workaround to start window as hidden...
32 | Opacity = 0;
33 | ShowInTaskbar = false;
34 | firstStart = true;
35 |
36 | InitializeComponent();
37 | InitializeState();
38 | }
39 |
40 | protected override void OnVisibleChanged(EventArgs e) {
41 | base.OnVisibleChanged(e);
42 |
43 | if (firstStart)
44 | {
45 | // Restore state from hacky workaround...
46 | Visible = false;
47 | Opacity = 100;
48 | ShowInTaskbar = true;
49 | firstStart = false;
50 | }
51 | }
52 |
53 | private void setHotkey(ModifierKeys modifierKeys, Keys key)
54 | {
55 | List txt = new List();
56 | txt.Add("Hotkey:");
57 |
58 | foreach (ModifierKeys mod in Enum.GetValues(typeof(ModifierKeys)))
59 | {
60 | if ((modifierKeys & mod) == mod)
61 | {
62 | txt.Add(mod.ToString());
63 | }
64 | }
65 |
66 | txt.Add(key.ToString());
67 | label_hotkey.Text = string.Join(" ", txt);
68 |
69 | if (_hotkeyRegistration == null || _hotkeyRegistration.Key != key || _hotkeyRegistration.Modifier != modifierKeys)
70 | {
71 | _hotkeyRegistration?.Unregister();
72 | try
73 | {
74 | _hotkeyRegistration = hook.RegisterHotKey(modifierKeys, key, Hook_KeyPress);
75 | }
76 | catch (InvalidOperationException ex)
77 | {
78 | label_hotkey.Text = "Could not register key";
79 | }
80 | }
81 |
82 | if (Properties.Settings.Default.hotkeyModifiers != modifierKeys || Properties.Settings.Default.hotkeyKey != key)
83 | {
84 | Properties.Settings.Default.hotkeyModifiers = modifierKeys;
85 | Properties.Settings.Default.hotkeyKey = key;
86 | Properties.Settings.Default.Save();
87 | }
88 | }
89 |
90 | private async void Hook_KeyPress()
91 | {
92 | await toggleMute();
93 | }
94 |
95 | private async void InitializeState()
96 | {
97 | setHotkey(Properties.Settings.Default.hotkeyModifiers, Properties.Settings.Default.hotkeyKey);
98 |
99 | contextMenu = new ContextMenu();
100 | menuItem1 = new MenuItem("Exit", (sender, args) => Dispose());
101 | contextMenu.MenuItems.Add(menuItem1);
102 | notifyIcon.ContextMenu = contextMenu;
103 |
104 | wantMute = await IsMuted();
105 | await SetMute(wantMute);
106 | timer_update.Enabled = true;
107 |
108 | notifyIcon.Visible = true;
109 | }
110 |
111 | private async void Button1_Click(object sender, EventArgs e)
112 | {
113 | await toggleMute();
114 | }
115 |
116 | private async Task toggleMute()
117 | {
118 | var devices = (await audioController.GetDevicesAsync(DeviceType.Capture, DeviceState.Active)).ToList();
119 | wantMute = !await IsMuted(devices);
120 | await SetMute(wantMute, devices);
121 |
122 | sound?.Stop();
123 | if (enableSound)
124 | {
125 | var soundFile = wantMute ? Properties.Resources.beep300 : Properties.Resources.beep750;
126 | sound = new SoundPlayer(soundFile);
127 | sound.Play();
128 | }
129 | else
130 | {
131 | sound = null;
132 | }
133 | }
134 |
135 | private async Task SetMute(bool mute, IEnumerable devices = null)
136 | {
137 | if (devices == null)
138 | {
139 | devices = await audioController.GetDevicesAsync(DeviceType.Capture, DeviceState.Active);
140 | }
141 |
142 | var changed = false;
143 |
144 | devices.Where(d => d.IsDefaultCommunicationsDevice || d.IsDefaultDevice).ToList()
145 | .ForEach(async device =>
146 | {
147 | if (device.IsMuted == mute) return;
148 | changed = true;
149 | await device.SetMuteAsync(mute);
150 | });
151 |
152 | BackColor = mute ? Color.Red : Color.Green;
153 | var Icon = mute ? Properties.Resources.red : Properties.Resources.green;
154 |
155 | notifyIcon.Icon = Icon;
156 | TaskbarManager.Instance.SetOverlayIcon(Handle, Icon, mute ? "Muted" : "Unmuted");
157 |
158 | return changed;
159 | }
160 |
161 | private async Task IsMuted(IEnumerable devices = null)
162 | {
163 | if (devices == null)
164 | {
165 | devices = await audioController.GetDevicesAsync(DeviceType.Capture, DeviceState.Active);
166 | }
167 |
168 | var firstDevice = devices.FirstOrDefault(d => d.IsDefaultCommunicationsDevice);
169 | return firstDevice != null && firstDevice.IsMuted;
170 | }
171 |
172 | private async void Timer_update_Tick(object sender, EventArgs e)
173 | {
174 | bool changed = await SetMute(wantMute);
175 |
176 | if (changed)
177 | {
178 | notifyIcon.BalloonTipText = $"Other application {(wantMute ? "enabled" : "disabled")} mic!";
179 | notifyIcon.ShowBalloonTip(5000);
180 | }
181 | }
182 |
183 | private void MainForm_Load(object sender, EventArgs e)
184 | {
185 |
186 | }
187 |
188 | private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
189 | {
190 | if (e.CloseReason == CloseReason.UserClosing && notifyIcon.Visible)
191 | {
192 | e.Cancel = true;
193 | Hide();
194 | }
195 | }
196 |
197 | private void doShow()
198 | {
199 | Show();
200 | WindowState = FormWindowState.Normal;
201 | Activate();
202 | }
203 |
204 | private void notifyIcon_DoubleClick(object sender, EventArgs e)
205 | {
206 | doShow();
207 | }
208 |
209 | private void notifyIcon_Click(object sender, EventArgs e) {
210 | doShow();
211 | }
212 |
213 | private void button2_KeyUp(object sender, KeyEventArgs e)
214 | {
215 | if (!updateHotkey) return;
216 | updateHotkey = false;
217 |
218 | ModifierKeys modifierKeys = 0;
219 |
220 | if (e.Control)
221 | {
222 | modifierKeys |= MicHotkey.ModifierKeys.Control;
223 | }
224 |
225 | if (e.Alt)
226 | {
227 | modifierKeys |= MicHotkey.ModifierKeys.Alt;
228 | }
229 |
230 | if (e.Shift)
231 | {
232 | modifierKeys |= MicHotkey.ModifierKeys.Shift;
233 | }
234 |
235 | if ((e.Modifiers & Keys.LWin) == Keys.LWin || (e.Modifiers & Keys.RWin) == Keys.RWin)
236 | {
237 | modifierKeys |= MicHotkey.ModifierKeys.Win;
238 | }
239 |
240 | setHotkey(modifierKeys, e.KeyCode);
241 | }
242 |
243 | private void button_hotkey_Click(object sender, EventArgs e)
244 | {
245 | if (updateHotkey)
246 | {
247 | updateHotkey = false;
248 | setHotkey(_hotkeyRegistration.Modifier, _hotkeyRegistration.Key);
249 | }
250 | else
251 | {
252 | updateHotkey = true;
253 | label_hotkey.Text = "Press key...";
254 | }
255 | }
256 |
257 | private void button_hotkey_Leave(object sender, EventArgs e)
258 | {
259 | updateHotkey = false;
260 | setHotkey(_hotkeyRegistration.Modifier, _hotkeyRegistration.Key);
261 | }
262 | }
263 | }
--------------------------------------------------------------------------------
/MicHotkey/MicHotkey.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {01EB6A64-2168-4C6A-A3C4-181A58D2DFCB}
8 | WinExe
9 | MicHotkey
10 | MicHotkey
11 | v4.7.2
12 | 512
13 | true
14 | true
15 |
16 |
17 |
18 |
19 | 10.0.18362.0
20 | AnyCPU
21 | true
22 | full
23 | false
24 | bin\Debug\
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | AnyCPU
31 | pdbonly
32 | true
33 | bin\Release\
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 | mixed.ico
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | Form
58 |
59 |
60 | MainForm.cs
61 |
62 |
63 |
64 |
65 |
66 | MainForm.cs
67 | Designer
68 |
69 |
70 | ResXFileCodeGenerator
71 | Resources.Designer.cs
72 | Designer
73 |
74 |
75 | True
76 | Resources.resx
77 | True
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 | 4.0.0-alpha5
95 |
96 |
97 | 4.1.0
98 |
99 |
100 | 1.1.0.2
101 |
102 |
103 | 1.1.1
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/MicHotkey/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 |
8 | namespace MicHotkey
9 | {
10 | static class Program
11 | {
12 | ///
13 | /// The main entry point for the application.
14 | ///
15 | [STAThread]
16 | static void Main() {
17 | using (Mutex mutex = new Mutex(true, "4e91d651-9c37-4859-b54c-a169c7c9cb74", out var createdNew))
18 | {
19 | if (createdNew)
20 | {
21 | Application.EnableVisualStyles();
22 | Application.SetCompatibleTextRenderingDefault(false);
23 |
24 | Application.Run(new MainForm());
25 | }
26 | else
27 | {
28 | Application.Exit();
29 | }
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/MicHotkey/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("MicHotkey")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("MicHotkey")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
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("01eb6a64-2168-4c6a-a3c4-181a58d2dfcb")]
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 |
--------------------------------------------------------------------------------
/MicHotkey/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 MicHotkey.Properties {
12 | using System;
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", "16.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MicHotkey.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
65 | ///
66 | internal static System.IO.UnmanagedMemoryStream beep300 {
67 | get {
68 | return ResourceManager.GetStream("beep300", resourceCulture);
69 | }
70 | }
71 |
72 | ///
73 | /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
74 | ///
75 | internal static System.IO.UnmanagedMemoryStream beep750 {
76 | get {
77 | return ResourceManager.GetStream("beep750", resourceCulture);
78 | }
79 | }
80 |
81 | ///
82 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
83 | ///
84 | internal static System.Drawing.Icon green {
85 | get {
86 | object obj = ResourceManager.GetObject("green", resourceCulture);
87 | return ((System.Drawing.Icon)(obj));
88 | }
89 | }
90 |
91 | ///
92 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
93 | ///
94 | internal static System.Drawing.Icon red {
95 | get {
96 | object obj = ResourceManager.GetObject("red", resourceCulture);
97 | return ((System.Drawing.Icon)(obj));
98 | }
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/MicHotkey/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 |
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 |
122 | ..\beep300.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
123 |
124 |
125 | ..\beep750.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
126 |
127 |
128 | ..\green.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
129 |
130 |
131 | ..\red.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
132 |
133 |
--------------------------------------------------------------------------------
/MicHotkey/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 MicHotkey.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("0")]
29 | public global::MicHotkey.ModifierKeys hotkeyModifiers {
30 | get {
31 | return ((global::MicHotkey.ModifierKeys)(this["hotkeyModifiers"]));
32 | }
33 | set {
34 | this["hotkeyModifiers"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("F24")]
41 | public global::System.Windows.Forms.Keys hotkeyKey {
42 | get {
43 | return ((global::System.Windows.Forms.Keys)(this["hotkeyKey"]));
44 | }
45 | set {
46 | this["hotkeyKey"] = value;
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/MicHotkey/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 0
7 |
8 |
9 | F24
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MicHotkey/Resources/green.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/Resources/green.ico
--------------------------------------------------------------------------------
/MicHotkey/Resources/red.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/Resources/red.ico
--------------------------------------------------------------------------------
/MicHotkey/beep300.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/beep300.wav
--------------------------------------------------------------------------------
/MicHotkey/beep750.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/beep750.wav
--------------------------------------------------------------------------------
/MicHotkey/green.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/green.ico
--------------------------------------------------------------------------------
/MicHotkey/green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/green.png
--------------------------------------------------------------------------------
/MicHotkey/mixed.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/mixed.ico
--------------------------------------------------------------------------------
/MicHotkey/mixed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/mixed.png
--------------------------------------------------------------------------------
/MicHotkey/red.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/red.ico
--------------------------------------------------------------------------------
/MicHotkey/red.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wouterh-dev/MicKey/1a7bf351dcb268a9fd3380641d51ca76ee9fae6e/MicHotkey/red.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MicKey
2 |
3 | MicKey is a small standalone Windows utility to toggle the microphone system-wide using a shortcut.
4 |
5 | ## Usage
6 |
7 | Download the application from the GitHub releases and run it.
8 |
9 | It will appear in the system tray:
10 |
11 | | Muted | Unmuted |
12 | |-------|---------|
13 | |  |  |
14 |
15 | Click the tray icon to show the main window, or right click the tray icon to exit the application.
16 |
17 | | Muted | Unmuted |
18 | |-------|---------|
19 | |  |  |
20 |
21 | Here you can set the global hotkey, which works even if the application is minimized, or toggle the mute.
22 |
23 | The window will always show itself on top of other windows, as it is intended to be used as an indicator to see whether the microphone is currently muted or not. You can close the window to return it to the tray, or minimize it to keep the task bar indicator:
24 |
25 | | Muted | Unmuted |
26 | |-------|---------|
27 | |  |  |
28 |
29 | Tip: By default the hotkey is set to F24, which most keyboards tend not to have. It may be useful to bind this key to your mouse buttons!
30 |
31 | ## Automatically launch on startup
32 |
33 | To automatically launch this program on startup:
34 |
35 | 1. Press Win+R to open the Run dialog and type `shell:startup` then press enter
36 |
37 | 2. Right click in the resulting folder and choose New -> Shortcut
38 |
39 | 3. Make a shortcut to your `MicKey.exe`
40 |
41 | ## How does it work?
42 |
43 | This program mutes the currently active microphone for communication on the operating
44 | system level, which works for all communication software that is configured to use
45 | the default microphone.
46 |
47 | To see this setting:
48 |
49 | 1. Find Sound Settings in the start menu
50 | 2. Click Sound Control Panel under Related Settings
51 | 3. Click the Recording tab
52 | 4. Locate the microphone set as default recording device
53 | 5. Right click -> Properties
54 | 6. Click the Levels tab
55 | 7. The  button shows if muted
--------------------------------------------------------------------------------