# Leader key respecting the current state of shift

**URL:** <https://community.keyboard.io/t/leader-key-respecting-the-current-state-of-shift/2124>\
**Category:** Help and Getting Started\
**Tags:** plugin\
**Created:** [October 19, 2018, 6:03pm UTC](https://community.keyboard.io/t/leader-key-respecting-the-current-state-of-shift/2124 "2018-10-19T18:03:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/michael/32/1038_2.png) [@michael](https://community.keyboard.io/u/michael)\
**Post date:** [October 19, 2018, 6:03pm UTC](https://community.keyboard.io/t/leader-key-respecting-the-current-state-of-shift/2124/1 "2018-10-19T18:03:11Z")

</div>

I’m trying to reduce my german layout by turning the dedicated keys for `ä`, `ö` and `ü` into a “dead-key” for the diaeresis + the key for `a`, `o` and `u`.

The leader-plugin looked promising to fulfill that requirement. So I implemented the following:

```auto
static const kaleidoscope::Leader::dictionary_t leader_dictionary[] PROGMEM =
  LEADER_DICT(
    {LEADER_SEQ(LEAD(0), Key_A), leaderAE},
  );

static void leaderAE(uint8_t seq_index) {
  kaleidoscope::hid::pressKey(key);
  kaleidoscope::hid::sendKeyboardReport();
  kaleidoscope::hid::releaseKey(key);
}

```

I discovered two issues with this approach:

1. I have to tap (press and release) the leader key before I start pressing the next key otherwise the next key seems to cancel the leader-key.
2. My expectation was, that holding the shift-key while pressing the leader-sequence would result in a capital `Ä`. That is not the case. Instead my shift-key seems to get “locked” and I get allcaps till I press it again.

Is there a better approach? In order to be able to use my keyboardio on any (windows)-computer in germany one requirement is, that it should work with the default OS-keymap.

Any help will be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [October 19, 2018, 6:43pm UTC](https://community.keyboard.io/t/leader-key-respecting-the-current-state-of-shift/2124/2 "2018-10-19T18:43:12Z")

</div>

> [@michael](#):
>
> I have to tap (press and release) the leader key before I start pressing the next key otherwise the next key seems to cancel the leader-key.

Indeed, and this is by design. The Leader key is not a modifier, and doesn’t try to emulate one.

> [@michael](#):
>
> My expectation was, that holding the shift-key while pressing the leader-sequence would result in a capital `Ä` . That is not the case. Instead my shift-key seems to get “locked” and I get allcaps till I press it again.

Part of this (shift getting locked) is a bug. Not working with shift is, again, by design - Leader does not support chording, only discrete keys. Making it support chording would be far too expensive as far as I can tell.

> [@michael](#):
>
> Is there a better approach?

I’d suggest using a [OneShot layer](https://github.com/keyboardio/Kaleidoscope/blob/master/doc/plugin/OneShot.md#osllayer) instead of a Leader key, that works fine with modifiers. On the oneshot layer, you can put either macros, or keys, wherever convenient.

I’m using this setup for Hungarian input, and it’s been a blast so far. (But then, I’m using OneShot for everything, which makes it a bit easier to get used to it.)

---

<div class="post-metadata">

**Author:** ![michael](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/michael/32/1038_2.png) [@michael](https://community.keyboard.io/u/michael)\
**Post date:** [October 20, 2018, 8:20am UTC](https://community.keyboard.io/t/leader-key-respecting-the-current-state-of-shift/2124/3 "2018-10-20T08:20:24Z")

</div>

> [@algernon](#):
>
> I’d suggest using a [OneShot layer](https://github.com/keyboardio/Kaleidoscope/blob/master/doc/plugin/OneShot.md#osllayer) instead of a Leader key, that works fine with modifiers. On the oneshot layer, you can put either macros, or keys, wherever convenient.

Thank you @algernon. That is a perfect solution. I don’t know why I didn’t think of it in the first place.

Now I’m wondering if it is possible to put a OneShot layer onto the same key on the OneShot layer to simulate a kind of tap-dance behaviour where I can switch from é to è… Will try 🙂

> [@algernon](#):
>
> > I have to tap (press and release) the leader key before I start pressing the next key otherwise the next key seems to cancel the leader-key.
> 
> Indeed, and this is by design. The Leader key is not a modifier, and doesn’t try to emulate one.

I’m still wondering about this. Because I would imagine tapping the leader-key and a sequence, which is in the dictionary, in quick succession so, that the first key of the sequence will end up pressed, before the leader key was released. To my understanding that is not possible at the moment.

---

<div class="post-metadata">

**Author:** ![michael](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/michael/32/1038_2.png) [@michael](https://community.keyboard.io/u/michael)\
**Post date:** [October 20, 2018, 9:02am UTC](https://community.keyboard.io/t/leader-key-respecting-the-current-state-of-shift/2124/4 "2018-10-20T09:02:54Z")

</div>

> [@michael](#):
>
> Now I’m wondering if it is possible to put a OneShot layer onto the same key on the OneShot layer to simulate a kind of tap-dance behaviour where I can switch from é to è… Will try 🙂

It is possible but it doesn’t work reliably. I manage to get stuck on my first diacritics layer when I try to do that. And I don’t always get to the second layer when I press the OSL-key twice while holding down shift. Maybe that has to do with my macros. I’m going to play around with it for a little while longer and am going to post an update if i figured what is going wrong.
