diff options
Diffstat (limited to 'keyboards/anavi/macropad8/keymaps/vlc/keymap.c')
-rw-r--r-- | keyboards/anavi/macropad8/keymaps/vlc/keymap.c | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/keyboards/anavi/macropad8/keymaps/vlc/keymap.c b/keyboards/anavi/macropad8/keymaps/vlc/keymap.c new file mode 100644 index 000000000..3e15a8186 --- /dev/null +++ b/keyboards/anavi/macropad8/keymaps/vlc/keymap.c | |||
@@ -0,0 +1,138 @@ | |||
1 | /* Copyright 2021 Marc Nause <[email protected]> | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include QMK_KEYBOARD_H | ||
18 | |||
19 | enum custom_layers { | ||
20 | _PLAY, | ||
21 | _FRAME, | ||
22 | _DVD, | ||
23 | _FN | ||
24 | }; | ||
25 | |||
26 | #define KC_X0 LT(_FN, KC_ESC) | ||
27 | |||
28 | #ifdef RGBLIGHT_ENABLE | ||
29 | // How long (in ms) to wait between animation steps for the rainbow mode | ||
30 | const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {60, 30, 15}; | ||
31 | // How long (in milliseconds) to wait between animation steps for each of the "Swirling rainbow" animations | ||
32 | const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {20, 10, 4}; | ||
33 | #endif | ||
34 | |||
35 | /* | ||
36 | * The keymap contains 3 layers for vlc hotkeys and a 4th layer | ||
37 | * for controlling the backlighting and the underlighting. | ||
38 | * | ||
39 | * See https://wiki.videolan.org/QtHotkeys/ for VLC hotkeys | ||
40 | * | ||
41 | * - Layer for VLC media play hotkeys: | ||
42 | * Space - Play/pause | ||
43 | * P - Previous track | ||
44 | * S - Stop | ||
45 | * N - Next track | ||
46 | * + - Slower | ||
47 | * - - Faster | ||
48 | * = - Normal rate | ||
49 | * | ||
50 | * - Layer for VLC frame control hotkeys: | ||
51 | * Shift + right arrow - Jump 5 seconds forward | ||
52 | * Alt + right arrow - Jump 10 seconds forward | ||
53 | * Control + right arrow - Jump 1 minute forward | ||
54 | * E - Next frame | ||
55 | * Shift + left arrow - Jump 5 seconds back | ||
56 | * Alt + left arrow - Jump 10 seconds back | ||
57 | * Control + left arrow - Jump 1 minute back | ||
58 | * | ||
59 | * - Layer for VLC DVD hotkeys: | ||
60 | * Shift + M - Disc menu | ||
61 | * Arrow up - Navigate menu (up) | ||
62 | * Enter - Select menu entry | ||
63 | * Shift + V - Toggle subtitles | ||
64 | * Arrow left - Navigate menu (left) | ||
65 | * Arrow down - Navigate menu (down) | ||
66 | * Arrow right - Navigate menu (right) | ||
67 | */ | ||
68 | |||
69 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
70 | [_PLAY] = LAYOUT_ortho_2x4( | ||
71 | KC_SPC, KC_P, KC_S, KC_N, | ||
72 | KC_KP_PLUS, KC_KP_MINUS, KC_KP_EQUAL, TO(_FRAME) | ||
73 | ), | ||
74 | |||
75 | [_FRAME] = LAYOUT_ortho_2x4( | ||
76 | LSFT(KC_RIGHT), LALT(KC_RIGHT), LCTL(KC_RIGHT), KC_E, | ||
77 | LSFT(KC_LEFT), LALT(KC_LEFT), LCTL(KC_LEFT), TO(_DVD) | ||
78 | ), | ||
79 | |||
80 | [_DVD] = LAYOUT_ortho_2x4( | ||
81 | LSFT(KC_M), KC_UP, KC_ENTER, LSFT(KC_V), | ||
82 | KC_LEFT, KC_DOWN, KC_RIGHT, TO(_FN) | ||
83 | ), | ||
84 | |||
85 | [_FN] = LAYOUT_ortho_2x4( | ||
86 | RGB_TOG, RGB_MOD, RGB_M_R, RGB_M_SN, | ||
87 | BL_TOGG, BL_STEP, BL_BRTG, TO(_PLAY) | ||
88 | ) | ||
89 | }; | ||
90 | |||
91 | #ifdef OLED_ENABLE | ||
92 | oled_rotation_t oled_init_user(oled_rotation_t rotation) { | ||
93 | return OLED_ROTATION_180; // flips the display 180 degrees if offhand | ||
94 | } | ||
95 | |||
96 | void oled_task_user(void) { | ||
97 | // Host Keyboard Layer Status | ||
98 | oled_write_ln_P(PSTR("ANAVI Macro Pad 8"), false); | ||
99 | oled_write_P(PSTR("Layer: "), false); | ||
100 | |||
101 | switch (get_highest_layer(layer_state)) { | ||
102 | case _PLAY: | ||
103 | oled_write_ln_P(PSTR("VLC Play"), false); | ||
104 | break; | ||
105 | case _FRAME: | ||
106 | oled_write_ln_P(PSTR("VLC Frame"), false); | ||
107 | break; | ||
108 | case _DVD: | ||
109 | oled_write_ln_P(PSTR("VLC DVD"), false); | ||
110 | break; | ||
111 | case _FN: | ||
112 | oled_write_ln_P(PSTR("FN "), false); | ||
113 | break; | ||
114 | default: | ||
115 | // Or use the write_ln shortcut over adding '\n' to the end of your string | ||
116 | oled_write_ln_P(PSTR("N/A"), false); | ||
117 | } | ||
118 | |||
119 | // Host Keyboard LED Status | ||
120 | led_t led_state = host_keyboard_led_state(); | ||
121 | oled_write_P(PSTR("Num Lock: "), false); | ||
122 | oled_write_ln_P(led_state.num_lock ? PSTR("On") : PSTR("Off"), false); | ||
123 | oled_write_P(PSTR("Caps Lock: "), false); | ||
124 | oled_write_ln_P(led_state.caps_lock ? PSTR("On") : PSTR("Off"), false); | ||
125 | oled_write_P(PSTR("Scroll Lock: "), false); | ||
126 | oled_write_ln_P(led_state.scroll_lock ? PSTR("On") : PSTR("Off"), false); | ||
127 | oled_write_P(PSTR("Backlit: "), false); | ||
128 | oled_write_ln_P(is_backlight_enabled() ? PSTR("On") : PSTR("Off"), false); | ||
129 | #ifdef RGBLIGHT_ENABLE | ||
130 | static char rgbStatusLine1[26] = {0}; | ||
131 | snprintf(rgbStatusLine1, sizeof(rgbStatusLine1), "RGB Mode: %d", rgblight_get_mode()); | ||
132 | oled_write_ln(rgbStatusLine1, false); | ||
133 | static char rgbStatusLine2[26] = {0}; | ||
134 | snprintf(rgbStatusLine2, sizeof(rgbStatusLine2), "h:%d s:%d v:%d", rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val()); | ||
135 | oled_write_ln(rgbStatusLine2, false); | ||
136 | #endif | ||
137 | } | ||
138 | #endif | ||