Having trouble with simple plugin

I’m trying to recreate the behavior I had set up under Kaleidoscope v1: What I want is to use the Fun key for layer switching, but have Shift (and maybe other keys) augment the layer switching. i.e. I want Fun to ShiftToLayer(FUNCTION), and Shift+Fun to ShiftToLayer(NUMPAD).

Here’s what I have at this point:

#define LFUN KeyAddr(3,6)
#define RFUN KeyAddr(3,9)
#define LSHIFT KeyAddr(3,7)
#define RSHIFT KeyAddr(3,8)
// (0, 7) (1, 7) (2, 7) (3, 7) | (3, 8) (2, 8)  (1, 8)  (0, 8)
//                      (3, 6) | (3, 9)
//

namespace kaleidoscope {
  namespace plugin {


  class ShiftedFun : public Plugin {
  public:
    EventHandlerResult onKeyEvent(KeyEvent &event) {
      bool shiftHeld = false;

      //    keyFromKeymap(layer, key_addr)
      if (event.addr == LFUN || event.addr == RFUN) {
        if (keyToggledOn(event.state)) {

        // If a Fun is pressed, consider layer, and set that ShiftToLayer on key
          if (live_keys[LSHIFT] != Key_Inactive && live_keys[LSHIFT] != Key_Masked) {
            shiftHeld = true;
            live_keys.mask(LSHIFT);
          }
          if (live_keys[RSHIFT] != Key_Inactive && live_keys[RSHIFT] != Key_Masked) {
            shiftHeld = true;
            live_keys.mask(RSHIFT);
          }
          if (shiftHeld) {
            Layer.activate(NUMPAD);
            live_keys.activate(event.addr, ShiftToLayer(NUMPAD));
          } else {
            Layer.activate(FUNCTION);
            live_keys.activate(event.addr, ShiftToLayer(FUNCTION));
          }
        } else {
          Layer.deactivate(NUMPAD);
          Layer.deactivate(FUNCTION);
        // If a Fun is released, undo whatever else we've done
        //    if Shift is live, set to Key_LShift (or R)
          if (live_keys[LSHIFT] != Key_Masked) {
            live_keys.activate(LSHIFT, keyFromKeymap(PRIMARY, LSHIFT));
          }
          if (live_keys[RSHIFT] != Key_Masked) {
            live_keys.activate(RSHIFT, keyFromKeymap(PRIMARY, RSHIFT));
          }
        }
      }

      if (event.addr == LSHIFT || event.addr == RSHIFT) {
        if (keyToggledOn(event.state)) {
        // If Shift is pressed, see if Fun is live - if not ignore
        //    if so, set pressed FUN to ShiftToLayer(NUMPAD)
        //      and mask this Shift
          if (live_keys[LFUN] != Key_Inactive && live_keys[LFUN] != Key_Masked) {
            live_keys.mask(event.addr);
            Layer.activate(NUMPAD);
            live_keys.activate(LFUN, ShiftToLayer(NUMPAD));
          }
          if (live_keys[RFUN] != Key_Inactive && live_keys[RFUN] != Key_Masked) {
            live_keys.mask(event.addr);
            Layer.activate(NUMPAD);
            live_keys.activate(LFUN, ShiftToLayer(NUMPAD));
          }
        } else {
        // If Shift is released, see if Fun is live
        //    if so, set pressed FUN to ShiftToLayer(PRIMARY)
          if (live_keys[LFUN] != Key_Inactive && live_keys[LFUN] != Key_Masked) {
            Layer.deactivate(NUMPAD);
            Layer.activate(FUNCTION);
            live_keys.activate(LFUN, ShiftToLayer(FUNCTION));
          }
          if (live_keys[RFUN] != Key_Inactive && live_keys[RFUN] != Key_Masked) {
            Layer.deactivate(NUMPAD);
            Layer.activate(FUNCTION);
            live_keys.activate(LFUN, ShiftToLayer(FUNCTION));
          }
        }

      }
      return EventHandlerResult::OK;
    }
  };

}
}
kaleidoscope::plugin::ShiftedFun ShiftedFun;

// First, tell Kaleidoscope which plugins you want to use.
// The order can be important. For example, LED effects are
// added in the order they're listed here.
KALEIDOSCOPE_INIT_PLUGINS(
  ShiftedFun,
  // ----------------------------------------------------------------------
//...
)

However, when I flash this, Fun still functions as ShiftToLayer(FUNCTION) (which is how it’s defined in the keymap), but nothing else seems to happen.

I feel like I’ve missed something fundamental.

Just to say: I’m using Combo at the moment to get Fun+Shift, but the way that it retains the key state until all the keys are released is what’s got me down. If I use Fun+Shift to go to the numpad, I want to be able to lift off of Fun and have the keyboard report the shift key being held - with Combo it stays in numpad. One critical example is working in Vim - I have a mirrored numpad on the left hand keyboard so that e.g. $ is under R, and I’ve gotten very used to particular flows of keystokes there.

If context helps, my configuration is up at GitHub - nyarly/keyboards - specifically model100/model100.ino.new