Table of Contents

dwm-mode

dwm patch for i3-like modes

quick launching with extensive keymap configurability

probably easier to base on dwm-keymodes patch and implement multiple command modes based on mode selection:
https://dwm.suckless.org/patches/keymodes/

outline

  1. set dwm titlebar text to mode text
  2. somehow wait for keypress and check against the mode's possible keypresses
  3. spawn or SHCMD command associated with matched keypress
  4. set dwm titlebar text to “done” or something generic

how to store modes, keymaps and text?

static const char *modetext[] = {
	"mode 1 text here",
	"mode 2 text here..."
};
 
// this is for one mode, now how for more?
static const Key *modekeys[] = {
	/* modifier     key        function        argument */
        { 0,		XK_u,      spawn,          {.v = dmenucharpick } },
};

void modes_setmode(char *modetext)

  1. set dwm titlebar text to mode text: void modes_setmode(char *modetext)
    • set active monitor (selmon) selected window's title (sel->name) to desired mode text
      • modetext is limited to 255 characters because of struct Client { char name[256] ...
      • strncpy(selmon->sel->name, modetext, 255)
    • redraw the bar
      • drawbar(selmon);
        • this redraws the whole dwm bar along with tags and status
        • there's probably a better way of doing this