Possible to configure Shift+LeftGui to input Alt+F2?

I understand that I can configure different layers where one layer contains LeftGui on a key and another contains Alt+F2. But is it possible to configure Shift+LeftGui to input Alt+F2?

It doesn’t seem sane to configure Shift for such layer change behaviour. So is this really hare-brained/impossible/not worth it?

namespace kaleidoscope {
class SLAltF2 : public kaleidoscope::Plugin {
  SLAltF2() {}

  EventHandlerResult onKeyswitchEvent(Key &mappedKey, byte row, byte col, 
                                      uint8_t keyState) {
    if (mappedKey == Key_LeftGUI && hid::wasModifierKeyPressed(Key_LeftShift)) {
      mappedKey = LALT(Key_F2);
    return EventHandlerResult::OK;

Something along these lines. The idea is that whenever a key is pressed, we check if that is the GUI key, then check is Shift was pressed previously, and if so, release shift, and change the current key. Otherwise leave everything as-is.

This only works when you press Shift first, but can be adapted to work in case Gui goes down first, too. Adding support for right shift is left as an exercise for the reader. :slight_smile:


This won’t work if your intention is to use those two left-side thumb keys with the same finger on the default layout, but here’s another option that might also work for you:

You could use Qukeys to configure any of your modifier keys to be F2 when tapped, and use your regular alt key normally to modify it. For example, you could replace Key_LeftGui with GUI_T(F2) in your keymap. Then holding alt and tapping cmd would result in alt+F2.


[Note: Qukeys is a lot of code. If you just want this one thing, it may be less work to implement it with the existing plugin, but @algernon’s solution has a much, much smaller footprint on the MCU, so if your sketch is already pushing the boundaries of the chip’s memory, a miniature custom plugin is the way to go.]