|
| 1 | +## ADDED Requirements |
| 2 | + |
| 3 | +### Requirement: Local shortcuts are active while any app window has focus |
| 4 | +The system SHALL handle a configurable set of keyboard shortcuts that fire when the user presses a bound key while any Pomotroid window (main or settings) has OS focus. Local shortcuts SHALL NOT fire when the focus is inside a text input element. |
| 5 | + |
| 6 | +#### Scenario: Shortcut fires in main window |
| 7 | +- **WHEN** the main timer window has OS focus |
| 8 | +- **AND** the user presses the key bound to pause/resume |
| 9 | +- **THEN** the timer SHALL toggle between running and paused |
| 10 | + |
| 11 | +#### Scenario: Shortcut fires in settings window |
| 12 | +- **WHEN** the settings window has OS focus |
| 13 | +- **AND** the user presses the key bound to volume up |
| 14 | +- **THEN** the volume SHALL increase by 5% |
| 15 | + |
| 16 | +#### Scenario: Shortcut does not fire when input is focused |
| 17 | +- **WHEN** a text input or shortcut capture field has keyboard focus |
| 18 | +- **AND** the user presses a key that is bound to a local shortcut |
| 19 | +- **THEN** the shortcut action SHALL NOT execute and the keypress SHALL be handled normally by the input |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +### Requirement: Default local shortcut bindings |
| 24 | +The system SHALL provide the following default local shortcut bindings on all platforms: |
| 25 | +- Pause/Resume: Space |
| 26 | +- Reset current round: ArrowLeft |
| 27 | +- Skip round: ArrowRight |
| 28 | +- Volume down: ArrowDown |
| 29 | +- Volume up: ArrowUp |
| 30 | +- Mute toggle: m |
| 31 | +- Fullscreen toggle: F11 |
| 32 | + |
| 33 | +#### Scenario: First launch defaults |
| 34 | +- **WHEN** the application is launched for the first time with no existing settings |
| 35 | +- **THEN** all seven local shortcut bindings SHALL match the defaults listed above |
| 36 | + |
| 37 | +#### Scenario: Existing bindings preserved across launches |
| 38 | +- **WHEN** the user has customized one or more local shortcut bindings and restarts the app |
| 39 | +- **THEN** the customized bindings SHALL be restored from the database |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +### Requirement: Local shortcut actions |
| 44 | +Each local shortcut SHALL invoke a specific action: |
| 45 | + |
| 46 | +- **Pause/Resume**: toggles the timer between running and paused (same as `timer_toggle` IPC command) |
| 47 | +- **Reset current round**: resets the current timer round to its full duration without advancing sequence (same as `timer_reset` IPC command) |
| 48 | +- **Skip round**: ends the current round and advances to the next in sequence (same as `timer_skip` IPC command) |
| 49 | +- **Volume down**: decreases volume by 5 percentage points, clamped to 0.0 |
| 50 | +- **Volume up**: increases volume by 5 percentage points, clamped to 1.0 |
| 51 | +- **Mute toggle**: toggles the volume between 0.0 and the last non-zero volume level |
| 52 | +- **Fullscreen toggle**: toggles the main window between fullscreen and its previous size/position |
| 53 | + |
| 54 | +#### Scenario: Volume up at maximum |
| 55 | +- **WHEN** the volume is at 1.0 (100%) |
| 56 | +- **AND** the user presses the volume up shortcut |
| 57 | +- **THEN** the volume SHALL remain at 1.0 (no overflow) |
| 58 | + |
| 59 | +#### Scenario: Volume down at minimum |
| 60 | +- **WHEN** the volume is at 0.0 (0%) |
| 61 | +- **AND** the user presses the volume down shortcut |
| 62 | +- **THEN** the volume SHALL remain at 0.0 (no underflow) |
| 63 | + |
| 64 | +#### Scenario: Mute restores previous volume |
| 65 | +- **WHEN** the volume is at 0.6 (60%) |
| 66 | +- **AND** the user presses the mute shortcut |
| 67 | +- **THEN** the volume SHALL be set to 0.0 |
| 68 | +- **WHEN** the user presses the mute shortcut again |
| 69 | +- **THEN** the volume SHALL be restored to 0.6 |
| 70 | + |
| 71 | +#### Scenario: Fullscreen toggle |
| 72 | +- **WHEN** the main window is in windowed mode |
| 73 | +- **AND** the user presses the fullscreen shortcut |
| 74 | +- **THEN** the main window SHALL enter fullscreen mode |
| 75 | +- **WHEN** the user presses the fullscreen shortcut again |
| 76 | +- **THEN** the main window SHALL exit fullscreen and return to windowed mode |
| 77 | + |
| 78 | +--- |
| 79 | + |
| 80 | +### Requirement: Local shortcuts are re-mappable in Settings |
| 81 | +The system SHALL allow users to change any local shortcut binding via Settings → Shortcuts. Each binding field SHALL record the next keypress (excluding modifier-only keys) as the new binding. The new binding SHALL be saved immediately and take effect without restart. |
| 82 | + |
| 83 | +#### Scenario: User rebinds pause/resume |
| 84 | +- **WHEN** the user clicks the pause/resume local shortcut field in Settings → Shortcuts |
| 85 | +- **AND** presses the P key |
| 86 | +- **THEN** the binding SHALL be updated to "p" in the database |
| 87 | +- **AND** pressing P while the main window is focused SHALL toggle the timer |
| 88 | + |
| 89 | +#### Scenario: Binding takes effect immediately |
| 90 | +- **WHEN** the user saves a new local shortcut binding |
| 91 | +- **AND** the settings window remains open |
| 92 | +- **THEN** pressing the newly bound key SHALL immediately trigger the corresponding action (no restart required) |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +### Requirement: Reset All Settings restores local shortcut defaults |
| 97 | +When the user resets all settings to defaults, all local shortcut bindings SHALL be reverted to their default values. |
| 98 | + |
| 99 | +#### Scenario: Reset restores default bindings |
| 100 | +- **WHEN** the user triggers "Reset All Settings" via the Settings menu |
| 101 | +- **THEN** all seven local shortcut bindings SHALL revert to their defaults (Space, ArrowLeft, ArrowRight, ArrowDown, ArrowUp, m, F11) |
| 102 | +- **AND** any custom bindings the user had configured SHALL be discarded |
0 commit comments