# How to create a macro like typing Space then OSM(LeftShift) with OneShot plugin

**URL:** <https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008>\
**Category:** Plugins\
**Tags:** question\
**Created:** [September 9, 2018, 7:28pm UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008 "2018-09-09T19:28:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandre.j.navarro](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/alexandre.j.navarro/32/128_2.png) [@alexandre.j.navarro](https://community.keyboard.io/u/alexandre.j.navarro)\
**Post date:** [September 9, 2018, 7:28pm UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/1 "2018-09-09T19:28:34Z")

</div>

How to create a macro like typing Space then OSM(LeftShift) with OneShot plugin

I tried some stuffs like

- OneShot.inject in a macro
- OneShot.inject isPressed , wasPessed in a macro
- MacroDown (Space, OSM(LeftShift));

Nevertheless nothing works like I want (do nothing or do some weird behaviour).

The goal is to have some direct keys like :  
Space + OSM(LeftShift)  
Return + OSM(LeftShift)  
. + Space + OSM(LeftShift)  
in order not to type shift key when previous key is a space, return or point then space for i

If someone how to do that or some ideas to try, I’m interested. Don’t hesitate to ask more explanation if it is not clear.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Llamalland](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/llamalland/32/832_2.png) [@Llamalland](https://community.keyboard.io/u/Llamalland)\
**Post date:** [September 10, 2018, 1:10am UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/2 "2018-09-10T01:10:17Z")

</div>

I ended up doing this with leader sequences instead, with leader + letter outputting full stop, space, capital of that letter. Here is the code, it’s just for full stop space capitalise, but it should be easy to adapt to your other cases with some search and replace. I included a leader + space sequence that doesn’t output a letter at all for when a non-capital starts the sentence, like “iPhone” or numbers or symbols. I made the leader time-out quite large for my own preference, others might not like it that high.

#include “Kaleidoscope-Leader.h”

// somewhere in keymap - LEAD(0)

static void leaderFSA(uint8\_t seq\_index) {  
Macros.type(PSTR(". A"));  
}  
static void leaderFSB(uint8\_t seq\_index) {  
Macros.type(PSTR(". B"));  
}  
static void leaderFSC(uint8\_t seq\_index) {  
Macros.type(PSTR(". C"));  
}  
static void leaderFSD(uint8\_t seq\_index) {  
Macros.type(PSTR(". D"));  
}  
static void leaderFSE(uint8\_t seq\_index) {  
Macros.type(PSTR(". E"));  
}  
static void leaderFSF(uint8\_t seq\_index) {  
Macros.type(PSTR(". F"));  
}  
static void leaderFSG(uint8\_t seq\_index) {  
Macros.type(PSTR(". G"));  
}  
static void leaderFSH(uint8\_t seq\_index) {  
Macros.type(PSTR(". H"));  
}  
static void leaderFSI(uint8\_t seq\_index) {  
Macros.type(PSTR(". I"));  
}  
static void leaderFSJ(uint8\_t seq\_index) {  
Macros.type(PSTR(". J"));  
}  
static void leaderFSK(uint8\_t seq\_index) {  
Macros.type(PSTR(". K"));  
}  
static void leaderFSL(uint8\_t seq\_index) {  
Macros.type(PSTR(". L"));  
}  
static void leaderFSM(uint8\_t seq\_index) {  
Macros.type(PSTR(". M"));  
}  
static void leaderFSN(uint8\_t seq\_index) {  
Macros.type(PSTR(". N"));  
}  
static void leaderFSO(uint8\_t seq\_index) {  
Macros.type(PSTR(". O"));  
}  
static void leaderFSP(uint8\_t seq\_index) {  
Macros.type(PSTR(". P"));  
}  
static void leaderFSQ(uint8\_t seq\_index) {  
Macros.type(PSTR(". Q"));  
}  
static void leaderFSR(uint8\_t seq\_index) {  
Macros.type(PSTR(". R"));  
}  
static void leaderFSS(uint8\_t seq\_index) {  
Macros.type(PSTR(". S"));  
}  
static void leaderFST(uint8\_t seq\_index) {  
Macros.type(PSTR(". T"));  
}  
static void leaderFSU(uint8\_t seq\_index) {  
Macros.type(PSTR(". U"));  
}  
static void leaderFSV(uint8\_t seq\_index) {  
Macros.type(PSTR(". V"));  
}  
static void leaderFSW(uint8\_t seq\_index) {  
Macros.type(PSTR(". W"));  
}  
static void leaderFSX(uint8\_t seq\_index) {  
Macros.type(PSTR(". X"));  
}  
static void leaderFSY(uint8\_t seq\_index) {  
Macros.type(PSTR(". Y"));  
}  
static void leaderFSZ(uint8\_t seq\_index) {  
Macros.type(PSTR(". Z"));  
}  
static void leaderFS(uint8\_t seq\_index) {  
Macros.type(PSTR(". "));  
}

static const kaleidoscope::Leader::dictionary\_t leader\_dictionary[] PROGMEM =  
LEADER\_DICT({LEADER\_SEQ(LEAD(0), Key\_A), leaderFSA},  
{LEADER\_SEQ(LEAD(0), Key\_B), leaderFSB},  
{LEADER\_SEQ(LEAD(0), Key\_C), leaderFSC},  
{LEADER\_SEQ(LEAD(0), Key\_D), leaderFSD},  
{LEADER\_SEQ(LEAD(0), Key\_E), leaderFSE},  
{LEADER\_SEQ(LEAD(0), Key\_F), leaderFSF},  
{LEADER\_SEQ(LEAD(0), Key\_G), leaderFSG},  
{LEADER\_SEQ(LEAD(0), Key\_H), leaderFSH},  
{LEADER\_SEQ(LEAD(0), Key\_I), leaderFSI},  
{LEADER\_SEQ(LEAD(0), Key\_J), leaderFSJ},  
{LEADER\_SEQ(LEAD(0), Key\_K), leaderFSK},  
{LEADER\_SEQ(LEAD(0), Key\_L), leaderFSL},  
{LEADER\_SEQ(LEAD(0), Key\_M), leaderFSM},  
{LEADER\_SEQ(LEAD(0), Key\_N), leaderFSN},  
{LEADER\_SEQ(LEAD(0), Key\_O), leaderFSO},  
{LEADER\_SEQ(LEAD(0), Key\_P), leaderFSP},  
{LEADER\_SEQ(LEAD(0), Key\_Q), leaderFSQ},  
{LEADER\_SEQ(LEAD(0), Key\_R), leaderFSR},  
{LEADER\_SEQ(LEAD(0), Key\_S), leaderFSS},  
{LEADER\_SEQ(LEAD(0), Key\_T), leaderFST},  
{LEADER\_SEQ(LEAD(0), Key\_U), leaderFSU},  
{LEADER\_SEQ(LEAD(0), Key\_V), leaderFSV},  
{LEADER\_SEQ(LEAD(0), Key\_W), leaderFSW},  
{LEADER\_SEQ(LEAD(0), Key\_X), leaderFSX},  
{LEADER\_SEQ(LEAD(0), Key\_Y), leaderFSY},  
{LEADER\_SEQ(LEAD(0), Key\_Z), leaderFSZ},  
{LEADER\_SEQ(LEAD(0), Key\_Spacebar), leaderFS});

KALEIDOSCOPE\_INIT\_PLUGINS(  
Leader,

)

void setup() {

Kaleidoscope.setup();

Leader.dictionary = leader\_dictionary;  
Leader.time\_out = 5000;

---

<div class="post-metadata">

**Author:** ![Llamalland](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/llamalland/32/832_2.png) [@Llamalland](https://community.keyboard.io/u/Llamalland)\
**Post date:** [September 10, 2018, 1:14am UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/3 "2018-09-10T01:14:03Z")

</div>

The only unfortunate thing is that you have to complete the leader key release before the letter’s keypress. Other than that, it works like a dream! You might also want to include something like when leader is pressed twice, it just outputs a full stop: I just use full stop on another layer personally.

---

<div class="post-metadata">

**Author:** ![Llamalland](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/llamalland/32/832_2.png) [@Llamalland](https://community.keyboard.io/u/Llamalland)\
**Post date:** [September 10, 2018, 1:17am UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/4 "2018-09-10T01:17:28Z")

</div>

I also use that leader key as a qukey, where held down, it is shift. I find it a very intuitive setup, but I guess it all depends if you usually use Shift on the right hand (since almost everyone is used to full stop on the right hand from QWERTY).

---

<div class="post-metadata">

**Author:** ![alexandre.j.navarro](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/alexandre.j.navarro/32/128_2.png) [@alexandre.j.navarro](https://community.keyboard.io/u/alexandre.j.navarro)\
**Post date:** [September 10, 2018, 6:45am UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/5 "2018-09-10T06:45:23Z")

</div>

Awesome. I did not realize I can do it with leader sequences. I will try it.  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![Llamalland](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/llamalland/32/832_2.png) [@Llamalland](https://community.keyboard.io/u/Llamalland)\
**Post date:** [September 10, 2018, 7:39am UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/6 "2018-09-10T07:39:38Z")

</div>

Not a problem, I’m glad someone else can benefit from it!

---

<div class="post-metadata">

**Author:** ![JDH](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@JDH](https://community.keyboard.io/u/JDH)\
**Post date:** [September 14, 2018, 3:38pm UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/7 "2018-09-14T15:38:22Z")

</div>

One thing I notice using this code: I have to release the keypress of the key ending the sequence before typing the next letter. This may not be an issue for others, but I’m realizing just how hard it can be for me to avoid this on letter combinations that I tend to roll. I wonder if that is a bug or just the way leader keys have been implemented.

---

<div class="post-metadata">

**Author:** ![Llamalland](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/llamalland/32/832_2.png) [@Llamalland](https://community.keyboard.io/u/Llamalland)\
**Post date:** [September 14, 2018, 4:09pm UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/8 "2018-09-14T16:09:30Z")

</div>

Yes, that bugs me as well - @algernon is aware of the issue I believe, and it is on his long long list of things to do. I’ve managed to change my habits temporarily to avoid it, but I hope I can resume some time not having to worry about depressing keys like that.

Actually, it’s a bit of an annoyance for me in general - it seems like several plugins are set up with a key-release mentality rather than the more natural-feeling key-down. Perhaps something to think about.

---

<div class="post-metadata">

**Author:** ![JDH](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@JDH](https://community.keyboard.io/u/JDH)\
**Post date:** [September 14, 2018, 4:29pm UTC](https://community.keyboard.io/t/how-to-create-a-macro-like-typing-space-then-osm-leftshift-with-oneshot-plugin/2008/9 "2018-09-14T16:29:14Z")

</div>

I think I’m going to try putting commonly-rolled sequences in my dictionary. Ex: {LEAD(0), Key T, Key H, leaderFSTH}

That might cut down on it.

Edit: weird behavior results from one sequence being contained within the other sequence
