small experimental changes (ctrl+tab, fn2+enter)
[tmk_keyboard.git] / keyboard / tv44 / keymap_tv44.c
CommitLineData
c646efd8 1#include "actionmap.h"
2#include "action_code.h"
3#include "actionmap_common.h"
970837c2 4#include "action.h"
970837c2 5#include "action_util.h"
4a638676 6
a17f4189 7/* Notes:
8595a3ee 8 * - Super+[hjkl] are uncomfortable to type
9 * - Fn3+[ÄÖÜäöüß] are uncomfortable to type
10 * - Fn2+[\~] are not the most comfortable to type
79ff83d8 11 */
12
f5d88f82 13// action key names are for german layout!
14#define AC_____ AC_NO
c646efd8 15#define AC_FN1 ACTION_LAYER_MOMENTARY(1)
04e43c66 16#define AC_FN2 ACTION_LAYER_MOMENTARY(2)
10e025ef 17#define AC_TAB2 ACTION_LAYER_TAP_KEY(2, KC_TAB)
8595a3ee 18#define AC_TAB3 ACTION_MODS_TAP_KEY(MOD_LCTL, KC_TAB)
19#define AC_FN2_ENT ACTION_LAYER_TAP_KEY(2, KC_ENT)
c646efd8 20#define AC_FN3 ACTION_LAYER_MOMENTARY(3)
21#define AC_DEG ACTION_MODS_KEY(MOD_LSFT, KC_GRV)
22#define AC_EXCL ACTION_MODS_KEY(MOD_LSFT, KC_1)
23#define AC_DQOT ACTION_MODS_KEY(MOD_LSFT, KC_2)
24#define AC_SECT ACTION_MODS_KEY(MOD_LSFT, KC_3)
25#define AC_DLLR ACTION_MODS_KEY(MOD_LSFT, KC_4)
26#define AC_PERC ACTION_MODS_KEY(MOD_LSFT, KC_5)
27#define AC_AMP ACTION_MODS_KEY(MOD_LSFT, KC_6)
28#define AC_SLAS ACTION_MODS_KEY(MOD_LSFT, KC_7)
29#define AC_LPAR ACTION_MODS_KEY(MOD_LSFT, KC_8)
30#define AC_RPAR ACTION_MODS_KEY(MOD_LSFT, KC_9)
31#define AC_EQUL ACTION_MODS_KEY(MOD_LSFT, KC_0)
c646efd8 32#define AC_GRAV ACTION_MODS_KEY(MOD_LSFT, KC_EQL)
33#define AC_SUP2 ACTION_MODS_KEY(MOD_RALT, KC_2)
34#define AC_SUP3 ACTION_MODS_KEY(MOD_RALT, KC_3)
35#define AC_LBRA ACTION_MODS_KEY(MOD_RALT, KC_7)
36#define AC_LBRK ACTION_MODS_KEY(MOD_RALT, KC_8)
37#define AC_RBRK ACTION_MODS_KEY(MOD_RALT, KC_9)
38#define AC_RBRA ACTION_MODS_KEY(MOD_RALT, KC_0)
39#define AC_BKSL ACTION_MODS_KEY(MOD_RALT, KC_MINS)
40#define AC_ASTK ACTION_MODS_KEY(MOD_LSFT, KC_RBRC)
41#define AC_SQOT ACTION_MODS_KEY(MOD_LSFT, KC_NUHS)
42#define AC_AT ACTION_MODS_KEY(MOD_RALT, KC_Q)
43#define AC_EUR ACTION_MODS_KEY(MOD_RALT, KC_E)
44#define AC_TILD ACTION_MODS_KEY(MOD_RALT, KC_RBRC)
45#define AC_RANG ACTION_MODS_KEY(MOD_LSFT, KC_NUBS)
46#define AC_BAR ACTION_MODS_KEY(MOD_RALT, KC_NUBS)
47#define AC_MU ACTION_MODS_KEY(MOD_RALT, KC_M)
48#define AC_CIRC AC_GRV
49#define AC_SS AC_MINS
50#define AC_PLUS AC_RBRC
51#define AC_HASH AC_NUHS
52#define AC_LANG AC_NUBS
53#define AC_DASH AC_SLSH
54#define AC_WORD ACTION_MODS_KEY(MOD_LCTL, KC_RIGHT)
55#define AC_BACK ACTION_MODS_KEY(MOD_LCTL, KC_LEFT)
1c87bc9a 56#define AC_AUML ACTION_MODS_KEY(MOD_LSFT, KC_QUOT)
57#define AC_OUML ACTION_MODS_KEY(MOD_LSFT, KC_SCLN)
58#define AC_UUML ACTION_MODS_KEY(MOD_LSFT, KC_LBRC)
c646efd8 59#define AC_aUML AC_QUOT
60#define AC_oUML AC_SCLN
61#define AC_uUML AC_LBRC
970837c2 62#define AC_SLQU ACTION_FUNCTION(SLASH_QUESTION)
c646efd8 63
970837c2 64enum function_id {
65 SLASH_QUESTION,
66};
67
68void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
970837c2 69 uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT));
a17f4189 70 static uint8_t slqu_pressed; //for SLASH_QUESTION
71
970837c2 72
73 switch (id) {
74 case SLASH_QUESTION:
a17f4189 75 /* when the key is pressed without any modifiers, a slash (Shift+7)
76 is typed; if shift is active, a question mark (Shift+ß) is typed.
77 Minor difference to native behaviour: if shift is released while
78 key is still held down, more question marks are typed instead of
79 switching to slashes. */
80 if (record->event.pressed) {
81 slqu_pressed = shifted?KC_MINS:KC_7;
aa0ff8ed 82 add_weak_mods(MOD_BIT(KC_LSHIFT)), send_keyboard_report();
83 add_key(slqu_pressed), send_keyboard_report();
970837c2 84 } else {
aa0ff8ed 85 del_key(slqu_pressed), send_keyboard_report();
86 del_weak_mods(MOD_BIT(KC_LSHIFT)), send_keyboard_report();
970837c2 87 }
970837c2 88 break;
89 }
90}
c646efd8 91
92const action_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = {
8595a3ee 93 /* Layer: Base Layer (L-CTRL is Tab too; R-Fn2 is Enter too)
5dd11e82 94 * ,-------------------------------------------------.
885c13e4 95 * |Esc| Q| W| E| R| T| Z| U| I| O| P| BSp |
5dd11e82 96 * |-------------------------------------------------|
970837c2 97 * |Ctrl| A| S| D| F| G| H| J| K| L| ?/|Fn2 |
5dd11e82 98 * |-------------------------------------------------|
885c13e4 99 * |Shift| Y| X| C| V| B| N| M| ,| .| -|Sft|
5dd11e82 100 * |-------------------------------------------------|
10e025ef 101 * |Alt |Tab/Fn2|Fn1 |Enter| Space |Fn1 |Super| Fn3 |
5dd11e82
J
102 * `-------------------------------------------------'
103 */
c646efd8 104 ACTIONMAP(
885c13e4 105 ESC , Q, W, E, R, T, Y, U, I, O, P, BSPC, \
8595a3ee 106 TAB3 , A, S, D, F, G, H, J, K, L,SLQU, FN2_ENT, \
c646efd8 107 LSHIFT, Z, X, C, V, B, N, M,COMM, DOT,DASH, RSHIFT, \
10e025ef 108 LALT, TAB2, FN1 , ENT, SPC, FN1, LGUI, FN3 ),
5dd11e82 109
8595a3ee 110 /* Layer: Movement Layer (wrd=ctrl-right, bck=crtl-left) MOMENTARY
5dd11e82 111 * ,-------------------------------------------------.
a578f9f4 112 * |Esc| |wrd| |END| | |PUp| |Hom|Ins| Del |
c646efd8 113 * |-------------------------------------------------|
885c13e4 114 * | | | |PDn| | |Lft| Up| Dn| Rt| | |
5dd11e82 115 * |-------------------------------------------------|
1c87bc9a 116 * | |PSc| | | |bck| |PAU|NUM|CAP|SCR| |
117 * |-------------------------------------------------|
f5d88f82 118 * | | | | | | | | |
5dd11e82 119 * `-------------------------------------------------'
c646efd8 120 */
121 ACTIONMAP(
a578f9f4 122 TRNS,____,WORD,____, END,____,____,PGUP,____,HOME, INS, DEL, \
1aa40b41 123 TRNS ,____,____,PGDN,____,____,LEFT,DOWN, UP,RGHT,____, TRNS, \
1c87bc9a 124 TRNS ,PSCR,____,____,____,BACK,____,PAUS,NLCK,CAPS,SLCK,TRNS, \
4a638676 125 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
5dd11e82 126
8595a3ee 127 /* Layer: Numbers and ASCII-Symbols Layer MOMENTARY
5dd11e82 128 * ,-------------------------------------------------.
10e025ef 129 * | ^| !| "| '| $| %| &| @| (| )| =| BSp |
5dd11e82 130 * |-------------------------------------------------|
1c87bc9a 131 * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0|Fn2 |
5dd11e82 132 * |-------------------------------------------------|
4a638676 133 * | #| <| || >| +| *| {| [| ]| }| \| ~|
5dd11e82
J
134 * |-------------------------------------------------|
135 * | | | | | | | | |
136 * `-------------------------------------------------'
137 */
c646efd8 138 ACTIONMAP(
10e025ef 139 CIRC,EXCL,DQOT,SQOT,DLLR,PERC, AMP, AT,LPAR,RPAR,EQUL, TRNS, \
c646efd8 140 GRAV , 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, \
141 HASH ,LANG, BAR,RANG,PLUS,ASTK,LBRA,LBRK,RBRK,RBRA,BKSL,TILD, \
5dd11e82
J
142 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
143
885c13e4 144 /* Layer: Layer for Function keys and Unicode Symbols MOMENTARY
5dd11e82 145 * ,-------------------------------------------------.
885c13e4 146 * | F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11| F12|
5dd11e82 147 * |-------------------------------------------------|
79ff83d8 148 * | | | | | | | | | Ä| Ö| Ü| |
c646efd8 149 * |-------------------------------------------------|
04e43c66 150 * | | €| §| °| ²| ³| µ| ä| ö| ü| ß| |
5dd11e82 151 * |-------------------------------------------------|
79ff83d8 152 * | | | | | | | | Fn3 |
5dd11e82
J
153 * `-------------------------------------------------'
154 */
c646efd8 155 ACTIONMAP(
4a638676 156 F1 , F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, \
970837c2 157 TRNS ,____,____,____,____,____,____,____,AUML,OUML,UUML, TRNS, \
04e43c66 158 TRNS , EUR,SECT, DEG,SUP2,SUP3, MU,aUML,oUML,uUML, SS,TRNS, \
79ff83d8 159 TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ),
5dd11e82 160};
Imprint / Impressum