Patch scrolling back in suckless ST terminal to support mouse wheel

The ST terminal has a patch for scrolling back. I want to update said patch to enable mouse wheel up and down signals in additions to “PageUp” and “PageDown”. I suspect that a small change in config.h is what is needed but I have no experience in terminal code thus my plea for help.

In the source code, in config.h these lines appear:

static Mousekey mshortcuts[] = {
    /* button               mask            string */
    { Button4,              XK_ANY_MOD,     "31" },
    { Button5,              XK_ANY_MOD,     "05" },
};

So, clearly, we know what Button4/5 are. In addition, we have these:

static Shortcut shortcuts[] = {
    /* mask                 keysym          function        argument */
    [...]
    { ShiftMask,            XK_Page_Up,     kscrollup,      {.i = -1} },
    { ShiftMask,            XK_Page_Down,   kscrolldown,    {.i = -1} },
};

So, naively, I a assuming that adding another two raw (one for wheel up, one for wheel down) would do the trick. However, what?


Note: I know that suckless recommends using a terminal multiplexer such as tmux. I use that already. However, sometimes (rarely) I just want to use a terminal without tmux and this feature would be useful. Please do not comment/answer to use tmux, this is not what this question is about.


Source: unix

Leave a Reply