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 /users | |
parent | c30170b868f50e74e52067ea78b184b7ee875be5 (diff) | |
download | qmk_firmware-9b398a8f31e31cd8aed60a2d90ada306213f70f5.tar.gz |
Partial and window screenshots (#9332)
Diffstat (limited to 'users')
-rw-r--r-- | users/spidey3/spidey3.c | 66 |
1 files changed, 66 insertions, 0 deletions
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) { spi_gflock = !spi_gflock; dprintf("spi_gflock = %u\n", spi_gflock); break; + + case KC_PSCR: { + uint8_t mods = get_mods(); +#ifndef NO_ACTION_ONESHOT + uint8_t osm = get_oneshot_mods(); +#else + uint8_t osm = 0; +#endif + + switch (get_unicode_input_mode()) { + case UC_MAC: + if ((mods | osm) & MOD_MASK_ALT) { + // Window screenshot + clear_mods(); +#ifndef NO_ACTION_ONESHOT + clear_oneshot_mods(); +#endif + tap_code16(LSFT(LGUI(KC_4))); + wait_ms(100); + tap_code(KC_SPC); + set_mods(mods); + return false; + } else if ((mods | osm) & MOD_MASK_SHIFT) { + // Partial screenshot + tap_code16(LSFT(LGUI(KC_4))); + return false; + } else { + // Full screenshot + tap_code16(LSFT(LGUI(KC_3))); + return false; + } + break; + + case UC_WIN: + case UC_WINC: + if ((mods | osm) & MOD_MASK_ALT) { + // Window screenshot + // Alt+PrintScreen should work as is + } else if ((mods | osm) & MOD_MASK_SHIFT) { + // Partial screenshot + tap_code16(LGUI(LSFT(KC_S))); + return false; + } else { + // Full screenshot + // PrintScreen should work as is + } + break; + + default: + // Note: These are specific to ChromeOS + if ((mods | osm) & MOD_MASK_ALT) { + // Window screenshot + tap_code16(LCTL(LALT(KC_F5))); + return false; + } else if ((mods | osm) & MOD_MASK_SHIFT) { + // Partial screenshot + tap_code16(LCTL(LSFT(KC_F5))); + return false; + } else { + // Full screenshot + // PrintScreen should work as is + } + break; + } + break; + } } } else { switch (keycode) { |