diff options
author | Joshua Diamond <josh@windowoffire.com> | 2020-06-23 22:02:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-24 12:02:12 +1000 |
commit | 9b398a8f31e31cd8aed60a2d90ada306213f70f5 (patch) | |
tree | a8ae34a08b7fd446a355a8580ba6fcd3daa57c55 | |
parent | c30170b868f50e74e52067ea78b184b7ee875be5 (diff) | |
download | qmk_firmware-9b398a8f31e31cd8aed60a2d90ada306213f70f5.tar.gz qmk_firmware-9b398a8f31e31cd8aed60a2d90ada306213f70f5.zip |
Partial and window screenshots (#9332)
-rw-r--r-- | layouts/community/75_ansi/spidey3/keymap.c | 3 | ||||
-rw-r--r-- | users/spidey3/spidey3.c | 66 |
2 files changed, 67 insertions, 2 deletions
diff --git a/layouts/community/75_ansi/spidey3/keymap.c b/layouts/community/75_ansi/spidey3/keymap.c index aaa93ee2d..d3c4a64ea 100644 --- a/layouts/community/75_ansi/spidey3/keymap.c +++ b/layouts/community/75_ansi/spidey3/keymap.c | |||
@@ -1,6 +1,5 @@ | |||
1 | #include "spidey3.h" | 1 | #include "spidey3.h" |
2 | 2 | ||
3 | #define OSX_PSC G(S(KC_4)) | ||
4 | #define FN_MENU LT(_FN,KC_APP) | 3 | #define FN_MENU LT(_FN,KC_APP) |
5 | 4 | ||
6 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 5 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
@@ -15,7 +14,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
15 | ), | 14 | ), |
16 | // OSX layout | 15 | // OSX layout |
17 | [_OSX] = LAYOUT_75_ansi( | 16 | [_OSX] = LAYOUT_75_ansi( |
18 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, OSX_PSC, _______, _______, | 17 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
19 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 18 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
20 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 19 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
21 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | 20 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index 4e364628a..a8dafcb7b 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c | |||
@@ -192,6 +192,72 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
192 | spi_gflock = !spi_gflock; | 192 | spi_gflock = !spi_gflock; |
193 | dprintf("spi_gflock = %u\n", spi_gflock); | 193 | dprintf("spi_gflock = %u\n", spi_gflock); |
194 | break; | 194 | break; |
195 | |||
196 | case KC_PSCR: { | ||
197 | uint8_t mods = get_mods(); | ||
198 | #ifndef NO_ACTION_ONESHOT | ||
199 | uint8_t osm = get_oneshot_mods(); | ||
200 | #else | ||
201 | uint8_t osm = 0; | ||
202 | #endif | ||
203 | |||
204 | switch (get_unicode_input_mode()) { | ||
205 | case UC_MAC: | ||
206 | if ((mods | osm) & MOD_MASK_ALT) { | ||
207 | // Window screenshot | ||
208 | clear_mods(); | ||
209 | #ifndef NO_ACTION_ONESHOT | ||
210 | clear_oneshot_mods(); | ||
211 | #endif | ||
212 | tap_code16(LSFT(LGUI(KC_4))); | ||
213 | wait_ms(100); | ||
214 | tap_code(KC_SPC); | ||
215 | set_mods(mods); | ||
216 | return false; | ||
217 | } else if ((mods | osm) & MOD_MASK_SHIFT) { | ||
218 | // Partial screenshot | ||
219 | tap_code16(LSFT(LGUI(KC_4))); | ||
220 | return false; | ||
221 | } else { | ||
222 | // Full screenshot | ||
223 | tap_code16(LSFT(LGUI(KC_3))); | ||
224 | return false; | ||
225 | } | ||
226 | break; | ||
227 | |||
228 | case UC_WIN: | ||
229 | case UC_WINC: | ||
230 | if ((mods | osm) & MOD_MASK_ALT) { | ||
231 | // Window screenshot | ||
232 | // Alt+PrintScreen should work as is | ||
233 | } else if ((mods | osm) & MOD_MASK_SHIFT) { | ||
234 | // Partial screenshot | ||
235 | tap_code16(LGUI(LSFT(KC_S))); | ||
236 | return false; | ||
237 | } else { | ||
238 | // Full screenshot | ||
239 | // PrintScreen should work as is | ||
240 | } | ||
241 | break; | ||
242 | |||
243 | default: | ||
244 | // Note: These are specific to ChromeOS | ||
245 | if ((mods | osm) & MOD_MASK_ALT) { | ||
246 | // Window screenshot | ||
247 | tap_code16(LCTL(LALT(KC_F5))); | ||
248 | return false; | ||
249 | } else if ((mods | osm) & MOD_MASK_SHIFT) { | ||
250 | // Partial screenshot | ||
251 | tap_code16(LCTL(LSFT(KC_F5))); | ||
252 | return false; | ||
253 | } else { | ||
254 | // Full screenshot | ||
255 | // PrintScreen should work as is | ||
256 | } | ||
257 | break; | ||
258 | } | ||
259 | break; | ||
260 | } | ||
195 | } | 261 | } |
196 | } else { | 262 | } else { |
197 | switch (keycode) { | 263 | switch (keycode) { |