Applied the 'launcher' patch, version '20200527-f09418b'.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
@@ -736,6 +762,13 @@ drawbar(Monitor *m)
|
||||
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) {
|
||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||
|
||||
Reference in New Issue
Block a user