summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--layouts/community/75_ansi/spidey3/keymap.c3
-rw-r--r--users/spidey3/spidey3.c66
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 aaa93ee2d0..d3c4a64ea8 100644
--- a/layouts/community/75_ansi/spidey3/keymap.c
+++ b/layouts/community/75_ansi/spidey3/keymap.c
@@ -1,6 +1,5 @@
#include "spidey3.h"
-#define OSX_PSC G(S(KC_4))
#define FN_MENU LT(_FN,KC_APP)
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_75_ansi(
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, OSX_PSC, _______, _______,
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c
index 4e364628aa..a8dafcb7b5 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) {