From bda4d15ffa5a7390591b2f4edb05ed568a1c708a Mon Sep 17 00:00:00 2001
From: JeeBak Kim <jeebak.kim@gmail.com>
Date: Sat, 6 Aug 2016 11:59:57 -0700
Subject: [PATCH] Add Virtual Desktop Switching macros to TouchCursor layer

---
 keyboards/planck/keymaps/jeebak/keymap.c  | 13 +++++++++++--
 keyboards/planck/keymaps/jeebak/readme.md |  5 +++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/keyboards/planck/keymaps/jeebak/keymap.c b/keyboards/planck/keymaps/jeebak/keymap.c
index c5761b2d1d..aa5c415938 100644
--- a/keyboards/planck/keymaps/jeebak/keymap.c
+++ b/keyboards/planck/keymaps/jeebak/keymap.c
@@ -47,6 +47,8 @@ enum macro_keycodes {
   KC_AG_CUT,
   KC_AG_COPY,
   KC_AG_PASTE,
+  KC_AG_DESK_L,
+  KC_AG_DESK_R,
 };
 
 // Fillers to make layering more clear
@@ -69,6 +71,8 @@ enum macro_keycodes {
 #define AG_CUT      M(KC_AG_CUT)
 #define AG_COPY     M(KC_AG_COPY)
 #define AG_PASTE    M(KC_AG_PASTE)
+#define AG_D_L      M(KC_AG_DESK_L)             // For Virtual Desktop Switching: Left, and
+#define AG_D_R      M(KC_AG_DESK_R)             //                                Right
 
 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
@@ -166,7 +170,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  * ,-----------------------------------------------------------------------------------.
  * |AltTab|CmdTab|CtlTab| GUI  |Shift |  ~   |Insert| Home |  Up  | End  | Bksp |      |
  * |------+------+------+------+------+-------------+------+------+------+------+------|
- * |      | Alt  |Space |      | Find |Again | PgUp | Left | Down |Right |      |      |
+ * |      | Alt  |Space |      | Find |Again | PgUp | Left | Down |Right |Desk_L|Desk_R|
  * |------+------+------+------+------+------|------+------+------+------+------+------|
  * |      | Undo | Cut  | Copy |Paste |  `   | PgDn | Del  |      |      |      |      |
  * |------+------+------+------+------+------+------+------+------+------+------+------|
@@ -179,7 +183,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 
 [_TOUCHCURSOR] = {
   {ALT_TAB, CMD_TAB, CTL_TAB, KC_LGUI, KC_LSFT, KC_TILD, KC_INS,  KC_HOME, KC_UP,   KC_END,  KC_BSPC, _______},
-  {_______, KC_LALT, KC_SPC,  _______, AG_FIND,AG_AGAIN, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______},
+  {_______, KC_LALT, KC_SPC,  _______, AG_FIND,AG_AGAIN, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, AG_D_L,  AG_D_R },
   {_______, AG_UNDO, AG_CUT,  AG_COPY, AG_PASTE,KC_GRV,  KC_PGDN, KC_DEL,  _______, _______, CMD_SLSH,_______},
   {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
 },
@@ -395,6 +399,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
         return use_cmd ? MACRODOWN( D(LGUI), T(C), END ) : MACRODOWN( D(LCTRL), T(C), END );
       case KC_AG_PASTE:
         return use_cmd ? MACRODOWN( D(LGUI), T(V), END ) : MACRODOWN( D(LCTRL), T(V), END );
+
+      case KC_AG_DESK_L:
+        return use_cmd ? MACRODOWN( D(LGUI), D(LCTRL), T(SCLN), END ) : MACRODOWN( D(LALT), D(LCTRL), T(SCLN), END );
+      case KC_AG_DESK_R:
+        return use_cmd ? MACRODOWN( D(LGUI), D(LCTRL), T(QUOT), END ) : MACRODOWN( D(LALT), D(LCTRL), T(QUOT), END );
     }
 
     return MACRO_NONE;
diff --git a/keyboards/planck/keymaps/jeebak/readme.md b/keyboards/planck/keymaps/jeebak/readme.md
index 359aacff97..28ae34f475 100644
--- a/keyboards/planck/keymaps/jeebak/readme.md
+++ b/keyboards/planck/keymaps/jeebak/readme.md
@@ -84,12 +84,13 @@ this layer. The `KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_FIND,` and `KC_AGAIN`
 keycodes do not seem to work. There are macros in place that'll "automatically"
 choose the correct version (`Cmd-Tab` vs. `Alt-Tab`, `Cmd-C` vs. `Ctrl-C`,
 etc.) depending on which layout you've currently selected (`AG_NORM` or
-`AG_SWAP`) in the `_ADJUST` layer.
+`AG_SWAP`) in the `_ADJUST` layer. The `Desk_L` and `Desk_R` macros are what I
+use to switch between Virtual Desktops Left/Right.
 ``` 
   ,-----------------------------------------------------------------------------------.
   |AltTab|CmdTab|CtlTab|  GUI |Shift |  ~   |Insert| Home |  Up  | End  | Bksp |      |
   |------+------+------+------+------+-------------+------+------+------+------+------|
-  |      | Alt  |Space |      | Find |Again | PgUp | Left | Down |Right |      |      |
+  |      | Alt  |Space |      | Find |Again | PgUp | Left | Down |Right |Desk_L|Desk_R|
   |------+------+------+------+------+------|------+------+------+------+------+------|
   |      | Undo | Cut  | Copy |Paste |  `   | PgDn | Del  |      |      |      |      |
   |------+------+------+------+------+------+------+------+------+------+------+------|