Page 1 of 1

Modifiers with layers.

Posted: 14 Jun 2014, 17:18
by Eszett
Hi! Is it possible to programm a keyboard controller, to have layers with modifiers, as ALT, CTRL, etc.?

As far as I understood it, something like ALT + F4 is sent from the keyboard controller as two separate scancodes to the OS. The OS interprets is as “close application”. So the keyboard controller isn’t responsible for these key combinations, it is the OS, which we can’t (or don’t want to) mess with.

But what about a layer key, which simulates to be ALT, for example FN, and when I press FN+F4 it sends ALT+F4 to the OS. Key combinations which aren’t defined yet by the OS could be user-defined.

Posted: 14 Jun 2014, 17:32
by ne0phyte
Same as last thread: you can do anything you want. This is all functionality on the controller side.
The controller tells the OS what keys/mods are pressed. How you map the physical keys to scancodes is your decision.

Keyboard: sends scancodes
OS: maps scancodes to symbols

How/where you let the keyboard send those scancodes doesn't matter to the OS.

Posted: 14 Jun 2014, 17:43
by IvanIvanovich
Right... make programming a multi key macro. So on the Fn layer F4 would = ALT+F4, you could do X to be CTRL+X and so on.

Posted: 14 Jun 2014, 17:44
by Eszett
Alright, let’s get specific. I want to tell the controller, that it sends the Yen character “¥” when I press ALT+Y (controller-side scancode interpretation). It is possible to do this with a Numpad-Code.

As IvanIvanovich says with a Fn layer, which simulates Fn+F4=>ALT+F4, Fn+O=>ALT+O, etc. Adding Fn+Y=>“¥”. Fine. But isn’t there a problem when things get complicated, e. g. ALT+CTRL+DEL?

Posted: 14 Jun 2014, 18:04
by IvanIvanovich
Nope. I had assigned some macros on my Access IS when I had set it up to use with Traktor DJ for example one key would have macro that would load selected track to deck B set sync to BPM with deck A and play which ended up being some string of several keys.

Posted: 14 Jun 2014, 18:36
by Eszett
@IvanIvanovich I mean, how to simulate key combinations with three keys, as ALT+CTRL+DEL with the proposed Fn layer? Maybe Fn+CTRL => ALT+CTRL (which, pressed together with DEL gives ALT+CTRL+DEL)? Does this work?

Posted: 14 Jun 2014, 18:41
by ne0phyte
You can put a macro with any amount of mods and keystrokes on a single key. I don't understand the question.
Have you looked into the documentation of TMK Keyboard to see what's possible without actually writing code?
> https://github.com/tmk/tmk_keyboard/blo ... /keymap.md

Posted: 14 Jun 2014, 19:13
by Eszett
I want to make FN behave like ALT in all common key combinations, incl. ALT+CTRL+DEL, that’s all.

Posted: 14 Jun 2014, 20:27
by IvanIvanovich
Do you have a keyboard that has no right Alt/Alt Gr and you want to make it's Fn key an Alt Gr? Otherwise, I guess you could make an Alt lock layer, where when you press FN+some key it sets FN to ALT. But you would need to map a Fn to somewhere else on that layer so you could leave it.
It still would make more sense to me to make macro functions really. A macro can be several keys, entire text strings ie a password, pretty much any keys available in any combination. So you could press Fn+Del and have that send CTRL+ALT+DEL or whatever.

Posted: 14 Jun 2014, 20:49
by Eszett
IvanIvanovich wrote:Do you have a keyboard that has no right Alt/Alt Gr and you want to make it's Fn key an Alt Gr?
No, I have an Alt/Alt Gr key and would like to use unassigned combinations with Alt for user-defined characters. Just as Alt Gr + E invokes the Euro sign “€” in my layout, I’d like to add the Yen symbol “¥” to Alt Gr + Y, while keeping all standard key combinations with Alt/AltGr. By creating a Fn layer I can simulate all combinations with Alt + another key, but how to simulate combinations with Alt + _two_ other keys, as Alt+Ctrl+Del? AFAIK a layer works like "press two keys together" not "press three keys together".

Posted: 14 Jun 2014, 20:55
by Muirium
Answer: macros.

Download Soarer's converter, and have a look in the /docs folder. You'll find out everything you can do with a Teensy.

http://deskthority.net/resources/file/6142

His documentation is pretty thorough. So definitely check it out, before we all start doing Kbdfr impressions…

Posted: 14 Jun 2014, 21:22
by IvanIvanovich
Oh I see. For other characters I use semi regularly not on my regular US or RU keymap... and since I use 60% most of the time and have no numpad I couldn't make ALT+code either. I just created a custom keymap in the OS. Sure, I could have just use US INTL... but the dead keys annoyed me. So anyway, I just press Alt+Shift to go to my keymap... press 1 key (€,£,È, etc.), switch back. It might be easier to create/customize your usual keymap in OS than programming firmware if you don't take the keyboard around to multiple computers all the time. Can't do macro with multi key strings that way though.

Posted: 14 Jun 2014, 22:07
by Eszett
If I assign on the FN layer the physical Ctrl key to the scancode "Ctrl" and the physical Del key to the scancode "Del + Alt" then I could press Fn + Ctrl + Del to get to the task manager, right? Then this would complete the simulation of an Alt key with advanced features. With a dirty trick however.

So many problems, because too many cooks spoil the broth. One cook is the keyboard controller, the other cook if the operating system. :cry:

Posted: 15 Jun 2014, 00:37
by IvanIvanovich
Well you could, but that doesn't make sense since you still have to press the same amount of keys. The whole point of macro to me is to make it so you have to press 2 keys at most. For example to make a macro that invokes sleep... Win+X+U+L so instead of pressing all that, you could press fn+S and have the same result.

Posted: 15 Jun 2014, 03:00
by Eszett
IvanIvanovich wrote:Well you could, but that doesn't make sense since you still have to press the same amount of keys. The whole point of macro to me is to make it so you have to press 2 keys at most.
Yes, but my aim isn’t to make something easier with macros, but to keep the Alt key behaving as normal Alt in all the key combinations Alt is usually involved in, while adding the feature that Alt+Y invokes the Yen-Symbol (by a macro that sends a numpad code for the Yen-Symbol).

I think an alternative method to the Fn layer method, which only simulates Alt actions, could be this:
-- If Alt is pressed send Alt scancode (as default)
-- Until Alt is released check if Y is pressed
-- if "Y" is pressed, send [numpad code for the Yen Symbol "¥"].
What do you think?