Lately I decided to give another shot to windows 10 for developing tasks. With WSL2, it kind of work for me so far. One thing I miss is a proper window manager. I was used to DWM and to be honest, windows is far behind in term of window management. This is due, partly, to wonky shortcut which you cannot modify easily.

In order to adress this frustration, I tried alot of tools like bug.n, aquasnap, MaxTo… Apart of bug.n which is a port of dwm (but is not stable enough IMO), others still rely too much on the mouse.

I decided to use the huge customization capabilities of the M01 to alleviate the hassle of managing windows.

The following customizations has been designed with two widescreen monitors in mind. They may not be adapted to other setups.

Instead of trying to copy the features of DWM, we will be approaching this using leader keys, which I find especially adapted for this use case. Enough talk, let’s dive in.

Shortcut Macro Description
    Set of shortcut to open programs quickly
Leader a Win+1 Launch or open first application pinned on the taskbar
Leader a a Win+1 1 Launch or open the second instance of the first application pinned on the taskbar
Leader aa Win+11 Launch or open the nth instance of the first application pinned on the taskbar
Leader ss Win+22 Launch or open the nth instance of the second application pinned on the taskbar
Leader dd Win+33 Launch or open the nth instance of the third application pinned on the taskbar
Leader ff Win+44 Launch or open the nth instance of the fourth application pinned on the taskbar
Leader gg Win+55 Launch or open the nth instance of the fifth application pinned on the taskbar
    Send program to monitor
Leader w f Shift+win+ Send program to right monitor
Leader w s Shift+win+ Send program to left monitor
    Control window size
Leader w w Shift+Win+ Maximize window vertically
Leader w w w Win+ Maximize window
    Window lifecycle
Leader w q alt+f4 Close application

The macros for maximizing windows (vertically) are a bit more complicated to avoid the windows snap features to interfere, in fact, before maximizing windows, the macro sends 【Alt+Space r1 to restore the window beforehand, thus letting the window to be in a predictable state before maximizing.

Now for the juicy part. To implement this in your firmware you will only need core plugins, Leader and Macro. I advise you to read their respective documentation thouroughly. Here is how to implement these shortcuts:

/* Leader configuration *****************************************************/
#define KEY_DELAYS 70 // Delay in ms on key part os the macro for windows to play nice
// Macros for focusing on apps
static void leaderWin1(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(1), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin2(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(2), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin3(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(3), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin4(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(4), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin5(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(5), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin11(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(1), D(1), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin22(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(2), D(2), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin33(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(3), D(3), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin44(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(4), D(4), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin55(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(5), D(5), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin111(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(1), D(1), D(1), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin222(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(2), D(2), D(2), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin333(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(3), D(3), D(3), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin444(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(4), D(4), D(4), W(KEY_DELAYS), U(LeftGui))); }
static void leaderWin555(uint8_t seq_index) { Macros.play(MACRO(D(LeftGui), D(5), D(5), D(5), W(KEY_DELAYS), U(LeftGui))); }
// Send to monitor right and left
static void leaderShiftWinRight(uint8_t seq_index) { Macros.play(MACRO( D(LeftGui), D(LeftShift), T(RightArrow), U(LeftGui), U(LeftShift) )); }
static void leaderShiftWinLeft(uint8_t seq_index) { Macros.play(MACRO( D(LeftGui), D(LeftShift), T(LeftArrow), U(LeftGui), U(LeftShift) )); }
// Size of window
static void leaderAltSpaceR(uint8_t seq_index) { Macros.play(MACRO( D(LeftAlt), T(Space), U(LeftAlt), W(KEY_DELAYS), T(R) )); }
static void leaderShiftWinUp(uint8_t seq_index) { leaderAltSpaceR(seq_index); Macros.play(MACRO( D(LeftGui), D(LeftShift), T(UpArrow), U(LeftGui), U(LeftShift) )); }
static void leaderWinUp(uint8_t seq_index) { leaderAltSpaceR(seq_index); Macros.play(MACRO( D(LeftGui), T(UpArrow), U(LeftGui) )); }
// 
static void leaderAltF4(uint8_t seq_index) { Macros.play(MACRO( D(LeftAlt), T(F4), U(LeftAlt))); }

/////
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =
  LEADER_DICT(
    //
      {LEADER_SEQ(LEAD(0), Key_A), leaderWin1}
    , {LEADER_SEQ(LEAD(0), Key_S), leaderWin2}
    , {LEADER_SEQ(LEAD(0), Key_D), leaderWin3}
    , {LEADER_SEQ(LEAD(0), Key_F), leaderWin4}
    , {LEADER_SEQ(LEAD(0), Key_G), leaderWin5}
    , {LEADER_SEQ(LEAD(0), Key_A, Key_A), leaderWin11}
    , {LEADER_SEQ(LEAD(0), Key_S, Key_S), leaderWin22}
    , {LEADER_SEQ(LEAD(0), Key_D, Key_D), leaderWin33}
    , {LEADER_SEQ(LEAD(0), Key_F, Key_F), leaderWin44}
    , {LEADER_SEQ(LEAD(0), Key_G, Key_G), leaderWin55}
    , {LEADER_SEQ(LEAD(0), Key_A, Key_A, Key_A), leaderWin111}
    , {LEADER_SEQ(LEAD(0), Key_S, Key_S, Key_S), leaderWin222}
    , {LEADER_SEQ(LEAD(0), Key_D, Key_D, Key_D), leaderWin333}
    , {LEADER_SEQ(LEAD(0), Key_F, Key_F, Key_F), leaderWin444}
    , {LEADER_SEQ(LEAD(0), Key_G, Key_G, Key_G), leaderWin555}
    //
    , {LEADER_SEQ(LEAD(0), Key_W, Key_F), leaderShiftWinRight}, {LEADER_SEQ(LEAD(0), Key_W, Key_L), leaderShiftWinRight}
    , {LEADER_SEQ(LEAD(0), Key_W, Key_S), leaderShiftWinLeft}, {LEADER_SEQ(LEAD(0), Key_W, Key_A), leaderShiftWinLeft}, {LEADER_SEQ(LEAD(0), Key_W, Key_H), leaderShiftWinLeft}
    //
    , {LEADER_SEQ(LEAD(0), Key_W, Key_W), leaderShiftWinUp}
    , {LEADER_SEQ(LEAD(0), Key_W, Key_W, Key_W), leaderWinUp}
    //
    , {LEADER_SEQ(LEAD(0), Key_W, Key_Q), leaderAltF4}, {LEADER_SEQ(LEAD(0), Key_Q, Key_Q), leaderAltF4}
    );
/***************************************************************************/

Here is the complete firmware with the above configuration (along with unrelated configurations): Model01-Firmware.ino

  1. This shortcut is dependent of your OS locale I believe