Add alpha toggle

This commit is contained in:
speediegq 2022-09-02 17:02:04 +02:00
parent 36621083ae
commit c95915fca6
4 changed files with 10 additions and 6 deletions

10
drw.c
View file

@ -8,6 +8,7 @@
#include "drw.h"
#include "util.h"
#include "toggle.h"
#define UTF_INVALID 0xFFFD
#define UTF_SIZ 4
@ -209,12 +210,15 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
if (!drw || !dest || !clrname)
return;
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap, clrname, dest)) {
die("error, cannot allocate color '%s'", clrname);
}
#if USEALPHA
dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
#else
dest->pixel |= 0xff << 24;
#endif
}

View file

@ -296,6 +296,7 @@ static char col_status15[] = "#ffffff";
* They can be anything from 0 (fully transparent) to 255 (fully opaque).
*
* You can also set OPAQUE and TRANSPARENT which are the same as 0 and 255 respectively.
* To completely disable alpha, disable it in toggle.h.
*/
static const unsigned int baropacity = 160; /* Opacity for the overall bar */
static const unsigned int layoutopacity = 160; /* Opacity for the layout indicator */

View file

@ -9,8 +9,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//#include <libgen.h>
//#include <sys/stat.h>
#include <limits.h>
#include <stdint.h>
#include <sys/types.h>

View file

@ -2,3 +2,4 @@
* This header allows you to enable/disable patches that can break compability with certain OSes or configurations.
*/
#define USEIPC 1 /* Whether or not to use IPC. If you set this to 1, set USEIPC to true in config.mk and comment the YAJLLIBS and YAJLINC lines in config.mk. Not compatible with BSDs so for those, set this to 0. */
#define USEALPHA 1 /* Whether or not to use transparency for the bar */