Skip to content

Commit

Permalink
fix(clafrica): update pause/resume logic (#54)
Browse files Browse the repository at this point in the history
Before, the holding of the CTRL can result in succession of switching of the idle mode.
But since it can be release once, just his release will be managed.
  • Loading branch information
pythonbrad committed Jun 29, 2023
1 parent be9c4b1 commit fc27710
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clafrica/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pub fn run(config: config::Config, mut frontend: impl Frontend) -> Result<(), io
idle = match event.event_type {
EventType::KeyPress(E_Key::Pause) => true,
EventType::KeyRelease(E_Key::Pause) => false,
EventType::KeyRelease(E_Key::ControlLeft | E_Key::ControlRight)
| EventType::KeyPress(E_Key::ControlLeft | E_Key::ControlRight) => {
EventType::KeyPress(E_Key::ControlLeft | E_Key::ControlRight) => idle,
EventType::KeyRelease(E_Key::ControlLeft | E_Key::ControlRight) => {
pause_counter += 1;

if pause_counter != 0 && pause_counter % 4 == 0 {
if pause_counter != 0 && pause_counter % 2 == 0 {
pause_counter = 0;
!idle
} else {
Expand Down

0 comments on commit fc27710

Please sign in to comment.