Maintenance - We're currently working on things and you might experience some issues. Should be wrapped up soon!

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

3
Depending on the current layer, switch to another one or send KC, with different behavior for hold/release
Author Summary
m0rpeth is in Kansas City, MO
Post Body

Sorry for the bad title - I tried to make it as descriptive as possible.

I basically want one of my keys to act as follows:

  • If the qwerty layer is active, just send space
  • If the qwerty layer is not active, move to the qwerty layer
  • If the key is held, momentarily enable the nav layer - regardless of what layer I'm on
  • If the key is released, disable the nav layer

The nav layer works just fine. Regardless of what layer is active, I can activate and use it by holding down KC_NAV. But I am neither able to type space on the qwerty layer, nor can I switch back to it if I'm on another layer (num or symbol). All my layers except the nav layer are intended to be toggled, not held, as that's more comfortable to me.

The code is as follows. Any ideas as to why it doesn't work are appreciated. :)

case KC_NAV:
    if (record->tap.count && record->event.pressed) {
        // on tap
        if (IS_LAYER_ON(LYR_QWR)) {
            tap_code(KC_SPC);
        } else {
            layer_move(LYR_QWR);
        }
    } else if (record->event.pressed) {
        // on hold
        if (IS_LAYER_OFF(LYR_NAV)) {
            layer_on(LYR_NAV);
        }
    } else {
        // on release
        if (IS_LAYER_ON(LYR_NAV)) {
            layer_off(LYR_NAV);
        }
    }
    return false;

Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
7,446
Link Karma
346
Comment Karma
7,068
Profile updated: 4 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
1 year ago