Add Contacts DWM plugin, desktop Menu/Names softkey labels, and 15px plugin label fonts
This commit is contained in:
+61
-4
@@ -49,6 +49,7 @@
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <xcb/res.h>
|
||||
#include <pango/pango.h>
|
||||
#include <pango/pangoxft.h>
|
||||
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
@@ -147,6 +148,7 @@ struct Monitor {
|
||||
Client *stack;
|
||||
Monitor *next;
|
||||
Window barwin;
|
||||
Window softwin;
|
||||
const Layout *lt[2];
|
||||
};
|
||||
|
||||
@@ -769,6 +771,10 @@ cleanupmon(Monitor *mon)
|
||||
}
|
||||
XUnmapWindow(dpy, mon->barwin);
|
||||
XDestroyWindow(dpy, mon->barwin);
|
||||
if (mon->softwin) {
|
||||
XUnmapWindow(dpy, mon->softwin);
|
||||
XDestroyWindow(dpy, mon->softwin);
|
||||
}
|
||||
free(mon);
|
||||
}
|
||||
|
||||
@@ -1021,6 +1027,35 @@ drawbar(Monitor *m)
|
||||
drw_text(drw, MAX(x, m->ww - sw), 0, sw, bh, 0, s, 0, True);
|
||||
}
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
if (m->softwin && drw && drw->font) {
|
||||
XLowerWindow(dpy, m->softwin);
|
||||
XClearWindow(dpy, m->softwin);
|
||||
if (!m->sel) {
|
||||
XftDraw *d = XftDrawCreate(dpy, m->softwin,
|
||||
DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
|
||||
if (d) {
|
||||
unsigned int ew = 0, eh = 0;
|
||||
const char *left_txt = "Menu";
|
||||
const char *right_txt = "Names";
|
||||
int sh_bar = 26;
|
||||
|
||||
drw_font_getexts(drw->font, left_txt, strlen(left_txt), &ew, &eh, False);
|
||||
int ty = (sh_bar - (int)eh) / 2;
|
||||
pango_layout_set_text(drw->font->layout, left_txt, strlen(left_txt));
|
||||
pango_xft_render_layout(d, &scheme[SchemeSel][ColFg],
|
||||
drw->font->layout, 6 * PANGO_SCALE, ty * PANGO_SCALE);
|
||||
|
||||
drw_font_getexts(drw->font, right_txt, strlen(right_txt), &ew, &eh, False);
|
||||
ty = (sh_bar - (int)eh) / 2;
|
||||
int rx = m->ww - (int)ew - 6;
|
||||
pango_layout_set_text(drw->font->layout, right_txt, strlen(right_txt));
|
||||
pango_xft_render_layout(d, &scheme[SchemeSel][ColFg],
|
||||
drw->font->layout, rx * PANGO_SCALE, ty * PANGO_SCALE);
|
||||
|
||||
XftDrawDestroy(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1806,6 +1841,10 @@ flush_pending_softkey(void)
|
||||
const Arg syscmd = { .v = (const char*[]){ "sxmo_appmenu.sh", "sys", NULL } };
|
||||
last_menu_pgid = spawn_pgid(&syscmd);
|
||||
} else if (pending == SOFTKEY_RIGHT) {
|
||||
if (host_is_idle_desktop() &&
|
||||
dispatch_plugin_idle_key(XF86XK_Back, 166, 0)) {
|
||||
return;
|
||||
}
|
||||
const Arg ctxcmd = { .v = (const char*[]){ "sxmo_appmenu.sh", NULL } };
|
||||
last_menu_pgid = spawn_pgid(&ctxcmd);
|
||||
}
|
||||
@@ -2170,9 +2209,12 @@ propertynotify(XEvent *e)
|
||||
Window trans;
|
||||
XPropertyEvent *ev = &e->xproperty;
|
||||
|
||||
if ((ev->window == root) && (ev->atom == XA_WM_NAME))
|
||||
updatestatus();
|
||||
else if (ev->state == PropertyDelete)
|
||||
if (ev->window == root) {
|
||||
if (ev->atom == XA_WM_NAME)
|
||||
updatestatus();
|
||||
else
|
||||
drawbars();
|
||||
} else if (ev->state == PropertyDelete)
|
||||
return; /* ignore */
|
||||
else if ((c = wintoclient(ev->window))) {
|
||||
switch(ev->atom) {
|
||||
@@ -2902,6 +2944,21 @@ updatebars(void)
|
||||
};
|
||||
XClassHint ch = {"dwm", "dwm"};
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (!m->softwin) {
|
||||
XSetWindowAttributes softwa = {
|
||||
.override_redirect = True,
|
||||
.background_pixmap = ParentRelative,
|
||||
.event_mask = ExposureMask
|
||||
};
|
||||
int sh_bar = 26;
|
||||
m->softwin = XCreateWindow(dpy, root, m->wx, m->my + m->mh - sh_bar, m->ww, sh_bar, 0,
|
||||
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
|
||||
CWOverrideRedirect|CWBackPixmap|CWEventMask, &softwa);
|
||||
XDefineCursor(dpy, m->softwin, cursor[CurNormal]->cursor);
|
||||
XMapWindow(dpy, m->softwin);
|
||||
XLowerWindow(dpy, m->softwin);
|
||||
XSetClassHint(dpy, m->softwin, &ch);
|
||||
}
|
||||
if (m->barwin)
|
||||
continue;
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
||||
@@ -3266,7 +3323,7 @@ wintomon(Window w)
|
||||
if (w == root && getrootptr(&x, &y))
|
||||
return recttomon(x, y, 1, 1);
|
||||
for (m = mons; m; m = m->next)
|
||||
if (w == m->barwin)
|
||||
if (w == m->barwin || w == m->softwin)
|
||||
return m;
|
||||
if ((c = wintoclient(w)))
|
||||
return c->mon;
|
||||
|
||||
Reference in New Issue
Block a user