-
-
Notifications
You must be signed in to change notification settings - Fork 7
Use DevWinUI for shortcut and textblock controls #104
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
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
30598d0
Add DevWinUI
ryanlua 31719cc
Remove preset hotkey logic
ryanlua b0ea013
Use DevWinUI.Controls IsEnabledTextBlock
ryanlua 15fe146
Remove control namespace
ryanlua 8f592bf
Add shortcut control
ryanlua c011e0f
Fix alignment
ryanlua 930be17
Fix sizing
ryanlua a5ccb12
Add hotkey debug
ryanlua 3fec6cb
Update DevWinUI.Controls version to 9.2.0
ryanlua 47ba12a
Remove alignment
ryanlua 8b72010
Disable shortcut
ryanlua 33271a2
Remove extra native method
ryanlua 91b61c3
Fix window monitor
ryanlua e2fe84e
Add hotkey manager
ryanlua 86209ed
Merge branch 'main' into shortcuts
ryanlua b9eb1da
Disable shortcut on toggle
ryanlua f8a434f
Update DevWinUI
ryanlua dbbb37b
Merge branch 'main' into shortcuts
ryanlua ee8e1a4
Update DevWinUI
ryanlua 8f0c31d
Merge branch 'main' into devwinui
ryanlua e51e38b
Add DevWinUI dependency to settings
ryanlua 0317a82
Merge branch 'main' into devwinui
ryanlua 6f64208
Merge branch 'main' into devwinui
ryanlua b18d31a
Update packages
ryanlua ad798d1
Reset to default key
ryanlua b1d1e20
Add default hotkey
ryanlua 0d61a8e
Merge branch 'main' into devwinui
ryanlua 09c8537
Fix build
ryanlua 9a55ea2
Fix or
ryanlua f9f4188
Add basic hotkey implementation
ryanlua 719345c
Cleanup structure
ryanlua 6c66fa4
Use PInvoke for message m
ryanlua 204bc01
Keep monitor alive
ryanlua f491550
Remove start delay
ryanlua 23889ca
Disable toggling auto clicker in settings
ryanlua 60038cf
Cleanup codr
ryanlua fbdef6f
Remove hard coded hotk
ryanlua e16969c
Add basic hotkey implementation
ryanlua 14da9cf
Cleanup structure
ryanlua df0dcdb
Use PInvoke for message m
ryanlua a614c1a
Keep monitor alive
ryanlua 03ba0e4
Remove start delay
ryanlua 786dbd2
Disable toggling auto clicker in settings
ryanlua 80132e8
Cleanup codr
ryanlua 56b6e21
Remove hard coded hotk
ryanlua 815a429
Merge branch 'devwinui' of https://github.com/ryanlua/auraclick into …
ryanlua 9bf349c
Fix using value for bool negation
ryanlua b750e8f
Fix monitor duplication
ryanlua d1683b2
Merge branch 'devwinui' of https://github.com/ryanlua/auraclick into …
ryanlua 90d4f07
Redirect to HEAD commit
ryanlua 0f6baf3
Add erroring for hotkeys
ryanlua 68be708
Merge branch 'main' into devwinui
ryanlua 189ca15
Update hotkey error dialog
ryanlua 9aa53fb
Merge branch 'devwinui' of https://github.com/ryanlua/auraclick into …
ryanlua File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 0 additions & 89 deletions
89
AuraClick/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
AuraClick/Controls/IsEnabledTextBlock/IsEnabledTextBlock.xaml
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| // Copyright (C) 2026 Ryan Luu | ||
| // | ||
| // This file is part of Aura Click. | ||
| // | ||
| // Aura Click is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published | ||
| // by the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // Aura Click is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU General Public License | ||
| // along with Aura Click. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| using DevWinUI; | ||
| using Windows.System; | ||
| using Windows.Win32; | ||
| using Windows.Win32.Foundation; | ||
| using Windows.Win32.UI.Input.KeyboardAndMouse; | ||
| using WinRT.Interop; | ||
|
|
||
| namespace AuraClick.Helpers; | ||
|
|
||
| internal static class HotkeyManager | ||
| { | ||
| public static bool RegisterHotkey(int hotkeyId, IEnumerable<object>? keys) | ||
| { | ||
| if (!TryGetHotkey(keys, out var modifiers, out var virtualKey)) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| var hWnd = new HWND(WindowNative.GetWindowHandle(App.MainWindow)); | ||
| UnregisterHotkey(hotkeyId); | ||
| return PInvoke.RegisterHotKey(hWnd, hotkeyId, ToWin32Modifiers(modifiers) | HOT_KEY_MODIFIERS.MOD_NOREPEAT, (uint)virtualKey); | ||
| } | ||
|
|
||
| public static bool UnregisterHotkey(int hotkeyId) | ||
| => PInvoke.UnregisterHotKey(new HWND(WindowNative.GetWindowHandle(App.MainWindow)), hotkeyId); | ||
|
|
||
| private static bool TryGetHotkey(IEnumerable<object>? keys, out VirtualKeyModifiers modifiers, out VirtualKey virtualKey) | ||
| { | ||
| modifiers = VirtualKeyModifiers.None; | ||
| virtualKey = VirtualKey.None; | ||
|
|
||
| if (keys is null) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| foreach (var key in keys) | ||
| { | ||
| if (key is not KeyVisualInfo keyInfo || keyInfo.Key is not VirtualKey keyCode) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| if (TryGetModifier(keyCode, out var modifier)) | ||
| { | ||
| modifiers |= modifier; | ||
| } | ||
| else | ||
| { | ||
| virtualKey = keyCode; | ||
| } | ||
| } | ||
|
|
||
| return virtualKey != VirtualKey.None; | ||
| } | ||
|
|
||
| private static bool TryGetModifier(VirtualKey keyCode, out VirtualKeyModifiers modifier) | ||
| { | ||
| modifier = keyCode switch | ||
| { | ||
| VirtualKey.Control or VirtualKey.LeftControl or VirtualKey.RightControl => VirtualKeyModifiers.Control, | ||
| VirtualKey.Shift or VirtualKey.LeftShift or VirtualKey.RightShift => VirtualKeyModifiers.Shift, | ||
| VirtualKey.Menu or VirtualKey.LeftMenu or VirtualKey.RightMenu => VirtualKeyModifiers.Menu, | ||
| VirtualKey.LeftWindows or VirtualKey.RightWindows => VirtualKeyModifiers.Windows, | ||
| _ => VirtualKeyModifiers.None, | ||
| }; | ||
|
|
||
| return modifier != VirtualKeyModifiers.None; | ||
| } | ||
|
|
||
| private static HOT_KEY_MODIFIERS ToWin32Modifiers(VirtualKeyModifiers modifiers) | ||
| { | ||
| HOT_KEY_MODIFIERS result = 0; | ||
| if ((modifiers & VirtualKeyModifiers.Control) != 0) result |= HOT_KEY_MODIFIERS.MOD_CONTROL; | ||
| if ((modifiers & VirtualKeyModifiers.Menu) != 0) result |= HOT_KEY_MODIFIERS.MOD_ALT; | ||
| if ((modifiers & VirtualKeyModifiers.Shift) != 0) result |= HOT_KEY_MODIFIERS.MOD_SHIFT; | ||
| if ((modifiers & VirtualKeyModifiers.Windows) != 0) result |= HOT_KEY_MODIFIERS.MOD_WIN; | ||
| return result; | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| RegisterHotKey | ||
| UnregisterHotKey | ||
| CallWindowProc | ||
| SendInput | ||
| SetProcessInformation | ||
| GetCurrentProcess | ||
| SetPriorityClass | ||
| PROCESS_POWER_THROTTLING_CURRENT_VERSION | ||
| PROCESS_POWER_THROTTLING_EXECUTION_SPEED | ||
| PROCESS_POWER_THROTTLING_STATE | ||
| PROCESS_POWER_THROTTLING_STATE | ||
| WM_HOTKEY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.