Skip to content
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

Preonic rotary encoder support for application switcher shortcuts #1342

Open
aharpole opened this issue Aug 1, 2024 · 1 comment
Open

Preonic rotary encoder support for application switcher shortcuts #1342

aharpole opened this issue Aug 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@aharpole
Copy link

aharpole commented Aug 1, 2024

Is your feature request related to a problem? Please describe.
I'd like for Chrysalis to natively support configuring the rotary encoder to control the macOS application switcher and other switcher-like interfaces.

Describe the solution you'd like
By default, rotary encoders are configured by mapping turning them to a particular keyboard shortcut.

This kind of works for application switchers like the one you get when you hit Cmd-Tab on a macOS device, but the app switcher on macOS has an affordance where you can press and hold the Cmd key, then press Tab, and while holding down the Cmd key, you can keep the app switcher open while you repeatedly press Tab (or Shift-Tab to move your selection back to the left).

I'd love to see Chrysalis supporting doing this with a rotary encoder, so that I could start turning the encoder to bring up the switcher, keep turning the knob in either direction to make my selection, then once I stop turning the knob, the keyboard releases the Cmd key and I switch to the selected application.

Windows has a similar window switcher that uses alt-tab and I believe it works in a similar fashion.

I've done this in QMK for a macro pad, and the code in keymap.c looks something like this:

// Timer variable for the delay for holding the Cmd key when turning the rotary encoder
static uint16_t cmd_timer;

bool encoder_update_user(uint8_t index, bool clockwise) {
    if (clockwise) {
        register_code(KC_LCMD);
        tap_code(KC_TAB);
        cmd_timer = timer_read(); // extend the timer another 750ms
    }
        
    else {
        register_code(KC_LCMD);
        register_code(KC_LSFT);
        tap_code(KC_TAB);
        unregister_code(KC_LSFT);
        cmd_timer = timer_read();  // extend the timer another 750ms
    }
        
    return false;
}

void matrix_scan_user(void) {
    // check if 500ms have passed since the rotary encoder was last turned
    if (timer_elapsed(cmd_timer) > 750) {
        unregister_code(KC_LCMD);
        cmd_timer = 0;      
    }
}

But in doing this, I basically need to jump down into building my own firmware, which I suspect I could do with the Keyboardio Preonic, but it would be really nice if support for this kind of function were built right into Chrysalis, with a couple different options (like supporting Alt-tab for Windows/Linux).

Describe alternatives you've considered
The workaround to this issue is to build firmware myself, but that's a huge lift for a single feature.

@aharpole aharpole added the enhancement New feature or request label Aug 1, 2024
@obra
Copy link
Member

obra commented Aug 1, 2024

That's a neat idea. Thank you for suggesting it. We're definitely going to have a bunch of fun work to do to enable cool encoder effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants