Applied the 'launcher' patch, version '20200527-f09418b'.

This commit is contained in:
2021-07-18 13:11:20 -05:00
parent 1f9b768475
commit 1f2d9deff4
2 changed files with 43 additions and 2 deletions
+8
View File
@@ -22,6 +22,14 @@ static const char *colors[][3] = {
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
/* launcher commands (They must be NULL terminated) */
static const char* kitty[] = { "kitty", NULL };
static const Launcher launchers[] = {
/* command name to display */
{ kitty, "Kitty" },
};
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
+35 -2
View File
@@ -142,6 +142,11 @@ typedef struct {
int monitor;
} Rule;
typedef struct {
const char** command;
const char* name;
} Launcher;
/* function declarations */
static void applyrules(Client *c);
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
@@ -444,10 +449,28 @@ buttonpress(XEvent *e)
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
} else if (ev->x < x + blw)
goto execute_handler;
} else if (ev->x < x + blw) {
click = ClkLtSymbol;
else if (ev->x > selmon->ww - (int)TEXTW(stext))
goto execute_handler;
}
x += blw;
for(i = 0; i < LENGTH(launchers); i++) {
x += TEXTW(launchers[i].name);
if (ev->x < x) {
Arg a;
a.v = launchers[i].command;
spawn(&a);
return;
}
}
if (ev->x > selmon->ww - (int)TEXTW(stext))
click = ClkStatusText;
else
click = ClkWinTitle;
} else if ((c = wintoclient(ev->window))) {
@@ -456,6 +479,9 @@ buttonpress(XEvent *e)
XAllowEvents(dpy, ReplayPointer, CurrentTime);
click = ClkClientWin;
}
execute_handler:
for (i = 0; i < LENGTH(buttons); i++)
if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
@@ -735,6 +761,13 @@ drawbar(Monitor *m)
w = blw = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
for (i = 0; i < LENGTH(launchers); i++)
{
w = TEXTW(launchers[i].name);
drw_text(drw, x, 0, w, bh, lrpad / 2, launchers[i].name, urg & 1 << i);
x += w;
}
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {