xbattmon

simple battery monitor for X
git clone git://git.2f30.org/xbattmon.git
Log | Files | Refs | README | LICENSE

commit b369e0130be8283a54f5355e135dcc8a3037dd65
parent bd914b372d4feeb470d8eec869d5efedce357eb9
Author: lostd <lostd@2f30.org>
Date:   Thu, 11 Jun 2015 00:26:39 +0100

Support for transparent mode that ignores the secondary colors

Diffstat:
config.def.h | 1+
xbattmon.c | 15+++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -10,3 +10,4 @@ int placement = BOTTOM; /* set to TOP if you want a top placement */ int maxcap = 100; /* maximum battery capacity */ int raise = 0; /* set to 1 if you want the bar to be raised on top of other windows */ int critical = 5; /* start blinking below 5% */ +int transparent = 0; /* transparent mode */ diff --git a/xbattmon.c b/xbattmon.c @@ -193,6 +193,21 @@ redraw(void) XFillRectangle(dpy, winbar, gcbar, 0, 0, thickness, barheight - pos); } + if (transparent == 1) { + if (blink == 0) + XMapWindow(dpy, winbar); + else + XUnmapWindow(dpy, winbar); + XSetForeground(dpy, gcbar, done); + if (placement == BOTTOM || placement == TOP) { + XResizeWindow(dpy, winbar, pos, thickness); + XFillRectangle(dpy, winbar, gcbar, 0, 0, pos, thickness); + } else { + XMoveResizeWindow(dpy, winbar, barx, barheight - pos, thickness, pos); + XFillRectangle(dpy, winbar, gcbar, 0, 0, thickness, barheight); + } + } + XFlush(dpy); }