diff --git a/suckless/dmenu/colors.h b/suckless/dmenu/colors.h index 46302c96..167cc3ea 100644 --- a/suckless/dmenu/colors.h +++ b/suckless/dmenu/colors.h @@ -11,13 +11,17 @@ static const char *colors[SchemeLast][2] = { }; -static const unsigned int bgalpha = 0xFF; -static const unsigned int fgalpha = OPAQUE; +static double opacity = 1.0; /* -o option; defines alpha translucency */ +static const unsigned int baralpha = 0xFF; +static const unsigned int borderalpha = OPAQUE; -static const unsigned int alphas[SchemeLast][2] = { - /* fgalpha bgalphga */ - [SchemeNorm] = { fgalpha, bgalpha }, - [SchemeSel] = { fgalpha, bgalpha }, - [SchemeOut] = { fgalpha, bgalpha }, + +static const unsigned int alphas[][3] = { + /* fg bg border */ + [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, + [SchemeSel] = { OPAQUE, baralpha, borderalpha }, + [SchemeOut] = { OPAQUE, baralpha, borderalpha }, + [SchemeNormHighlight] = { OPAQUE, baralpha, borderalpha }, + [SchemeSelHighlight] = { OPAQUE, baralpha, borderalpha }, }; diff --git a/suckless/dmenu/config.h b/suckless/dmenu/config.h index 91d8db98..332af34b 100644 --- a/suckless/dmenu/config.h +++ b/suckless/dmenu/config.h @@ -4,7 +4,8 @@ static int topbar = 1; /* -b option; if 0, dmenu appears at bottom */ /* -fn option overrides fonts[0]; default X11 font or font set */ static const char *fonts[] = { - "CaskaydiaCove Nerd Font Mono:size=10" + "CaskaydiaCove Nerd Font Mono:size=10", + "Symbola:pixelsize=16:antialias=true:autohint=true", }; static const char *prompt = NULL; /* -p option; prompt to the left of input field */ static const unsigned int min_lineheight = 27; diff --git a/suckless/dmenu/dmenu.c b/suckless/dmenu/dmenu.c index fc0c58bc..29dd998d 100644 --- a/suckless/dmenu/dmenu.c +++ b/suckless/dmenu/dmenu.c @@ -21,7 +21,8 @@ #include "util.h" /* macros */ -#define OPAQUE 0xFFU +#define OPAQUE 0xffU +#define OPACITY "_NET_WM_WINDOW_OPACITY" #define INTERSECT(x,y,w,h,r) (MAX(0, MIN((x)+(w),(r).x_org+(r).width) - MAX((x),(r).x_org)) \ * MAX(0, MIN((y)+(h),(r).y_org+(r).height) - MAX((y),(r).y_org))) #define LENGTH(X) (sizeof X / sizeof X[0]) @@ -85,13 +86,11 @@ xinitvisual() .depth = 32, .class = TrueColor }; - long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); visual = NULL; - - for (i = 0; i < nitems; i++){ + for(i = 0; i < nitems; i ++) { fmt = XRenderFindVisualFormat(dpy, infos[i].visual); if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { visual = infos[i].visual; @@ -111,7 +110,6 @@ xinitvisual() } } - static char** tokenize(char *source, char *delim, int *llen) { int listlength = 0; @@ -211,7 +209,8 @@ drawhighlights(struct item *item, int x, int y, int maxw) ? SchemeSelHighlight : SchemeNormHighlight]); for (i = 0, highlight = item->text; *highlight && text[i];) { - if (*highlight == text[i]) { + if (!fstrncmp(&(*highlight), &text[i], 1)) + { /* get indentation */ c = *highlight; *highlight = '\0'; @@ -235,7 +234,6 @@ drawhighlights(struct item *item, int x, int y, int maxw) } } - static int drawitem(struct item *item, int x, int y, int w) { @@ -251,6 +249,7 @@ drawitem(struct item *item, int x, int y, int w) r = drw_text(drw, x, y, w, bh, lrpad / 2, item->text, 0); drawhighlights(item, x, y, w); + /* TODO Fix Alpha conflict with drawhighlights */ return r; } @@ -894,7 +893,7 @@ setup(void) /* create menu window */ swa.override_redirect = True; - swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; + swa.background_pixel = 0; swa.border_pixel = 0; swa.colormap = cmap; swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask;