changeset: 863:e05fb6533b3d
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Sun Feb 26 12:52:05 2012 +0100
files: dwm.suckless.org/patches/defaulttransparency.md dwm.suckless.org/patches/dwm.defaultopacity.patch
description:
Reducing dependency on r-36.net.
diff -r 0c40b4ee4d5e -r e05fb6533b3d dwm.suckless.org/patches/defaulttransparency.md
--- a/dwm.suckless.org/patches/defaulttransparency.md Sun Feb 26 12:50:13 2012 +0100
+++ b/dwm.suckless.org/patches/defaulttransparency.md Sun Feb 26 12:52:05 2012 +0100
_AT_@ -15,7 +15,8 @@
## Download
- * [dwm.defaultopacity.patch](
http://www.r-36.net/src/tmp/dwm.defaultopacity.patch) latest patch (against r1521)
+ * [dwm.defaultopacity.patch](
http://dwm.suckless.org/patches/defaulttransparency)
+ latest patch (against r1521)
## Author
diff -r 0c40b4ee4d5e -r e05fb6533b3d dwm.suckless.org/patches/dwm.defaultopacity.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/dwm.defaultopacity.patch Sun Feb 26 12:52:05 2012 +0100
_AT_@ -0,0 +1,73 @@
+diff -r 53d98940cb04 config.def.h
+--- a/config.def.h Fri Jun 04 11:41:16 2010 +0100
++++ b/config.def.h Sun Jun 06 22:48:32 2010 +0200
+_AT_@ -12,14 +12,16 @@
+ static const unsigned int snap = 32; /* snap pixel */
+ static const Bool showbar = True; /* False means no bar */
+ static const Bool topbar = True; /* False means bottom bar */
++static const double defaultopacity = 0.75;
+_AT_@ -52,6 +54,9 @@
+ /* modifier key function argument */
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
++ { MODKEY|ShiftMask, XK_s, spawn, SHCMD("transset-df -a --dec .1") },
++ { MODKEY|ShiftMask, XK_d, spawn, SHCMD("transset-df -a --inc .1") },
++ { MODKEY|ShiftMask, XK_f, spawn, SHCMD("transset-df -a .75") },
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+diff -r 53d98940cb04 dwm.c
+--- a/dwm.c Fri Jun 04 11:41:16 2010 +0100
++++ b/dwm.c Sun Jun 06 22:48:32 2010 +0200
+_AT_@ -58,7 +58,7 @@
+ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
+ enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
+ enum { NetSupported, NetWMName, NetWMState,
+- NetWMFullscreen, NetLast }; /* EWMH atoms */
++ NetWMFullscreen, NetLast, NetWMWindowsOpacity }; /* EWMH atoms */
+ enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
+ enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
+ ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
+_AT_@ -179,6 +179,7 @@
+ static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
+ static void enternotify(XEvent *e);
+ static void expose(XEvent *e);
++static void opacity(Client *c, double opacity);
+ static void focus(Client *c);
+ static void focusin(XEvent *e);
+ static void focusmon(const Arg *arg);
+_AT_@ -816,6 +817,18 @@
+ }
+
+ void
++opacity(Client *c, double opacity)
++{
++ if(opacity >= 0 && opacity <= 1) {
++ unsigned long real_opacity[] = { opacity * 0xffffffff };
++ XChangeProperty(dpy, c->win, netatom[NetWMWindowsOpacity], XA_CARDINAL,
++ 32, PropModeReplace, (unsigned char *)real_opacity,
++ 1);
++ } else
++ XDeleteProperty(dpy, c->win, netatom[NetWMWindowsOpacity]);
++}
++
++void
+ focus(Client *c) {
+ if(!c || !ISVISIBLE(c))
+ for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
+_AT_@ -1104,6 +1117,7 @@
+ *c = cz;
+ c->win = w;
+ updatetitle(c);
++ opacity(c, defaultopacity);
+ if(XGetTransientForHint(dpy, w, &trans))
+ t = wintoclient(trans);
+ if(t) {
+_AT_@ -1539,6 +1553,7 @@
+ 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[NetWMWindowsOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
+ /* init cursors */
+ cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
+ cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
Received on Sun Feb 26 2012 - 12:55:58 CET