enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState,
- NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+ NetWMFullscreen, NetWMWindowOpacity, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
static Monitor *mons, *selmon;
static Window root;
+// unfocused windows get transparent (feature)
+static const unsigned long unfocused_opacity[] = { 0xbfffffff };
+static void window_set_opaque(Client *c);
+static void window_set_translucent(Client *c);
+void
+window_set_opaque(Client *c) {
+ XChangeProperty(dpy, c->win, netatom[NetWMWindowOpacity], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)unfocused_opacity, 1);
+}
+void
+window_set_translucent(Client *c) {
+ XDeleteProperty(dpy, c->win, netatom[NetWMWindowOpacity]);
+}
+
+
/* configuration, allows nested code to access above variables */
#include "config.h"
/* was if(selmon->sel) */
if(selmon->sel && selmon->sel != c)
unfocus(selmon->sel, False);
+ if(selmon->sel && c!=selmon->sel && c && (!root || (selmon->sel->win!=root && c->win!=root)) )
+ window_set_opaque(selmon->sel);
+ if(c && c!=selmon->sel && (!root || (c->win!=root)) )
+ window_set_translucent(c);
if(c) {
if(c->mon != selmon)
selmon = c->mon;
}
selmon->sel = c;
drawbars();
+ if(c)
+ window_set_translucent(c);
}
void
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
+ netatom[NetWMWindowOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);