Ctrl+Alt+Del mapping without plugin?


(Eric Osborne) #1

i just got my Model 01 yesterday, so I’m slowly climbing the learning curve. I went through the tutorial and can remap a single key (I bound Function+LeftCtl to Key_6). I’d like to map Function+LeftCtl to send Ctrl+Alt+Del. How do I do that? Do I need to use a plugin, or is this something i can do directly in the keymap? I found the ‘Mapping a single keypress to a chord’ topic, but I’m afraid I couldn’t quite parse out exactly what I was supposed to do.

Thanks!


(Andrew McCauley) #2

I had a bit of trouble finding this in the documentation, myself, eventually finding it in a forum post. What you want is to map, on your function layer in the spot where leftctrl is on your top layer, LCTRL(LALT(Key_Delete)).


(Eric Osborne) #3

Worked - thanks!

eric


Alt+tab remapped... maybe tap dance?
(Andrew McCauley) #4

No worries!

Maybe this is something worth adding to a page like this? Would be happy to myself, so long as that is ok to do.


(Eric Osborne) #5

Where do I find definitions for other keys? I’d like to map stuff to Any+$KEY so I think I need whatever the Any equivalent of LCTRL is.

eric


(Andrew McCauley) #6

I think there are only options for this for modifiers, not for regular keys. So L/R CRTL/ALT/SHIFT/GUI are I believe your only chording options.


(Gergely Nagy) #7

As @Llamalland correctly said, the LCTRL and similar things are only available for modifiers. The Any key is a macro. I assume you do not want the original Any key functionality in addition to whatever you map Any + $KEY to, right?

In that case, the easiest solution is to turn Any into a layer key, and introduce a new layer where you add the bindings. This way whenever you press the Any key, your keymap will switch to this newly added layer, where you bind keys as you see fit.

Here are the steps to do this:

Find the following line in your sketch:

enum { QWERTY, NUMPAD, FUNCTION }; // layers

Add a new layer here, you can name it pretty much anything (though, no spaces or punctuation allowed, it’s best to stick to alphanumerics). We could call it, say ANY:

enum { QWERTY, NUMPAD, FUNCTION, ANY }; // layers

Then, find the definition of the QWERTY layer, which looks like this:

  [QWERTY] = KEYMAP_STACKED
  (___,          Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
   Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
   Key_PageUp,   Key_A, Key_S, Key_D, Key_F, Key_G,
   Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
   Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
   ShiftToLayer(FUNCTION),

   M(MACRO_ANY),  Key_6, Key_7, Key_8,     Key_9,         Key_0,         LockLayer(NUMPAD),
   Key_Enter,     Key_Y, Key_U, Key_I,     Key_O,         Key_P,         Key_Equals,
                  Key_H, Key_J, Key_K,     Key_L,         Key_Semicolon, Key_Quote,
   Key_RightAlt,  Key_N, Key_M, Key_Comma, Key_Period,    Key_Slash,     Key_Minus,
   Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
   ShiftToLayer(FUNCTION))

Copy this, and paste it after the FUNCTION layer a few lines below (don’t forget to add a comma to the end of the function layer!).

You can then change this part of the keymap to add the bindings you desire. Anything that is on here, will be available only when you also hold Any.

Oh, we need to change that key too, don’t we?

Replace M(MACRO_ANY) with ShiftToLayer(ANY) on the QWERTY layer to do this.

A few hints: ___ on the keymap means that the key is transparent, and when you press it, the firmware will look at all the active layers below the current one, and use that key. So if you hold ANY, and have ___ in the Q position, ANY+Q will still input Q. On the other hand, XXX completely disables a key. This is useful if you want to shadow a layer below.

Hope this helps!


(Eric Osborne) #8

Thanks, that looks like exactly what I want! I’ll post back here if I get it working.

eric


(Eric Osborne) #9

Well, it sort of worked the first time, but I got it to work right the second time around. For the archives:

Code:

enum { QWERTY, NUMPAD, FUNCTION, ANY }; // layers

...

[QWERTY] = KEYMAP_STACKED
  (___,          Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
   Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
   Key_PageUp,   Key_A, Key_S, Key_D, Key_F, Key_G,
   Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
   Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
   ShiftToLayer(FUNCTION),

   ShiftToLayer(ANY),  Key_6, Key_7, Key_8,     Key_9,         Key_0,         LockLayer(NUMPAD),
   Key_Enter,     Key_Y, Key_U, Key_I,     Key_O,         Key_P,         Key_Equals,
		  Key_H, Key_J, Key_K,     Key_L,         Key_Semicolon, Key_Quote,
   Key_RightAlt,  Key_N, Key_M, Key_Comma, Key_Period,    Key_Slash,     Key_Minus,
   Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
   ShiftToLayer(FUNCTION)),

...
   
  [ANY] =  KEYMAP_STACKED
 (___, LCTRL(LALT(Key_Delete)), M(MACRO_ENPASS), XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX,
  XXX, 
    
  ___, XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX, XXX, XXX, XXX,
  XXX, XXX, XXX, XXX,
  XXX
  )

Initially I set up all unused keys as XXX except for Prog. But if I did that with the Any key, it would get stuck in the Any layer and never go back to Qwerty. Once I set Any to ‘___’ it all worked fine.

Thanks for your help!