1
0
Fork 0

Partial and window screenshots (#9332)

This commit is contained in:
Joshua Diamond 2020-06-23 22:02:12 -04:00 committed by GitHub
parent c30170b868
commit 9b398a8f31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 2 deletions

View file

@ -1,6 +1,5 @@
#include "spidey3.h" #include "spidey3.h"
#define OSX_PSC G(S(KC_4))
#define FN_MENU LT(_FN,KC_APP) #define FN_MENU LT(_FN,KC_APP)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -15,7 +14,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
), ),
// OSX layout // OSX layout
[_OSX] = LAYOUT_75_ansi( [_OSX] = LAYOUT_75_ansi(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, OSX_PSC, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,

View file

@ -192,6 +192,72 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
spi_gflock = !spi_gflock; spi_gflock = !spi_gflock;
dprintf("spi_gflock = %u\n", spi_gflock); dprintf("spi_gflock = %u\n", spi_gflock);
break; 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 { } else {
switch (keycode) { switch (keycode) {