/ doc / devdocs / modules / quickaccent.md
quickaccent.md
  1  # Quick Accent
  2  
  3  
  4  [Public overview - Microsoft Learn](https://learn.microsoft.com/en-us/windows/powertoys/quick-accent)
  5  
  6  ## Quick Links
  7  
  8  [All Issues](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen%20label%3A%22Product-Quick%20Accent%22)<br>
  9  [Bugs](https://github.com/microsoft/PowerToys/issues?q=is%3Aopen%20label%3AIssue-Bug%20label%3A%22Product-Quick%20Accent%22)<br>
 10  [Pull Requests](https://github.com/microsoft/PowerToys/pulls?q=is%3Apr+is%3Aopen+label%3A%22Product-Quick+Accent%22)
 11  
 12  ## Overview
 13  
 14  Quick Accent (formerly known as Power Accent) is a PowerToys module that allows users to quickly insert accented characters by holding a key and pressing an activation key (like the Space key or arrow keys). For example, holding 'a' might display options like 'à', 'á', 'â', etc. This tool enhances productivity by streamlining the input of special characters without the need to memorize keyboard shortcuts.
 15  
 16  ## Architecture
 17  
 18  The Quick Accent module consists of four main components:
 19  
 20  ```
 21  poweraccent/
 22  ├── PowerAccent.Core/               # Core component containing Language Sets
 23  ├── PowerAccent.UI/                 # The character selector UI
 24  ├── PowerAccentKeyboardService/     # Keyboard Hook
 25  └── PowerAccentModuleInterface/     # DLL interface
 26  ```
 27  
 28  ### Module Interface (PowerAccentModuleInterface)
 29  
 30  The Module Interface, implemented in `PowerAccentModuleInterface/dllmain.cpp`, is responsible for:
 31  - Handling communication between PowerToys Runner and the PowerAccent process
 32  - Managing module lifecycle (enable/disable/settings)
 33  - Launching and terminating the PowerToys.PowerAccent.exe process
 34  
 35  ### Core Logic (PowerAccent.Core)
 36  
 37  The Core component contains:
 38  - Main accent character logic
 39  - Keyboard input detection
 40  - Character mappings for different languages
 41  - Management of language sets and special characters (currency, math symbols, etc.)
 42  - Usage statistics for frequently used characters
 43  
 44  ### UI Layer (PowerAccent.UI)
 45  
 46  The UI component is responsible for:
 47  - Displaying the toolbar with accent options
 48  - Handling user selection of accented characters
 49  - Managing the visual positioning of the toolbar
 50  
 51  ### Keyboard Service (PowerAccentKeyboardService)
 52  
 53  This component:
 54  - Implements keyboard hooks to detect key presses
 55  - Manages the trigger mechanism for displaying the accent toolbar
 56  - Handles keyboard input processing
 57  
 58  ## Implementation Details
 59  
 60  ### Activation Mechanism
 61  
 62  The Quick Accent is activated when:
 63  1. A user presses and holds a character key (e.g., 'a')
 64  2. User presses the trigger key
 65  3. After a brief delay (around 300ms per setting), the accent toolbar appears
 66  4. The user can select an accented variant using the trigger key
 67  5. Upon releasing the keys, the selected accented character is inserted
 68  
 69  ### Character Sets
 70  
 71  The module includes multiple language-specific character sets and special character sets:
 72  - Various language sets for different alphabets and writing systems
 73  - Special character sets (currency symbols, mathematical notations, etc.)
 74  - These sets are defined in the core component and can be extended
 75  
 76  ### Known Behaviors
 77  
 78  - The module has a specific timing mechanism for activation that users have become accustomed to. Initially, this was considered a bug (where the toolbar would still appear even after quickly tapping and releasing keys), but it has been maintained as expected behavior since users rely on it.
 79  - Multiple rapid key presses can trigger multiple background tasks.
 80  
 81  ## Future Considerations
 82  
 83  - Potential refinements to the activation timing mechanism
 84  - Additional language and special character sets
 85  - Improved UI positioning in different application contexts
 86  
 87  ## Debugging
 88  
 89  To debug the Quick Accent module via **runner** approach, follow these steps:
 90  
 91  0. Get familiar with the overall [Debugging Process](../development/debugging.md) for PowerToys.
 92  1. **Build** the entire PowerToys solution in Visual Studio
 93  2. Navigate to the **PowerAccent** folder in Solution Explorer
 94  3. Open the file you want to debug and set **breakpoints** at the relevant locations
 95  4. Find the **runner** project in the root of the solution
 96  5. Right-click on the **runner** project and select "*Set as Startup Project*"
 97  6. Start debugging by pressing `F5` or clicking the "*Start*" button
 98  7. When the PowerToys Runner launches, **enable** the Quick Accent module in the UI
 99  8. Use the Visual Studio Debug menu or press `Ctrl+Alt+P` to open "*Reattach to Process*"
100  9. Find and select "**PowerToys.PowerAccent.exe**" in the process list
101  10. Trigger the action in Quick Accent that should hit your breakpoint
102  11. Verify that the debugger breaks at your breakpoint and you can inspect variables and step through code
103  
104  This process allows you to debug the Quick Accent module while it's running as part of the full PowerToys application.
105  
106  ### Alternative Debugging Approach
107  
108  To directly debug the Quick Accent UI component:
109  
110  0. Get familiar with the overall [Debugging Process](../development/debugging.md) for PowerToys.
111  1. **Build** the entire PowerToys solution in Visual Studio
112  2. Navigate to the **PowerAccent** folder in Solution Explorer
113  3. Open the file you want to debug and set **breakpoints** at the relevant locations
114  4. Right-click on the **PowerAccent.UI** project and select "*Set as Startup Project*"
115  5. Start debugging by pressing `F5` or clicking the "*Start*" button
116  6. Verify that the debugger breaks at your breakpoint and you can inspect variables and step through code
117  
118  **Known issue**: You may encounter approximately 78 errors during the start of debugging.<br>
119  **Solution**: If you encounter errors, right-click on the **PowerAccent** folder in Solution Explorer and select "*Rebuild*". After rebuilding, start debugging again.