changeset: 926:81211036de44
tag: tip
user: xulfer <xulfer_AT_cheapbsd.net>
date: Thu Apr 05 12:15:12 2012 -0500
files: dwm.suckless.org/patches/dwm-6.0-systray.diff dwm.suckless.org/patches/systray.md
description:
Updated systray patch to apply cleanly with 6.0.
diff -r 678e8e9bafba -r 81211036de44 dwm.suckless.org/patches/dwm-6.0-systray.diff
--- a/dwm.suckless.org/patches/dwm-6.0-systray.diff Wed Apr 04 22:21:45 2012 +0200
+++ b/dwm.suckless.org/patches/dwm-6.0-systray.diff Thu Apr 05 12:15:12 2012 -0500
_AT_@ -1,27 +1,45 @@
-Author: Jan Christoph Ebersbach <jceb_AT_e-jc.de>, inspired by
http://code.google.com/p/dwm-plus
-URL:
http://dwm.suckless.org/patches/systray
-Implements a system tray for dwm.
-
-diff -r 10e232f9ace7 config.def.h
---- a/config.def.h Sun Mar 25 17:49:35 2012 +0200
-+++ b/config.def.h Wed Apr 04 22:18:50 2012 +0200
-_AT_@ -10,6 +10,8 @@
- static const char selfgcolor[] = "#eeeeee";
- static const unsigned int borderpx = 1; /* border pixel of windows */
- static const unsigned int snap = 32; /* snap pixel */
-+static const unsigned int systrayspacing = 2; /* systray spacing */
-+static const Bool showsystray = True; /* False means no systray */
- static const Bool showbar = True; /* False means no bar */
- static const Bool topbar = True; /* False means bottom bar */
+diff -rupN dwm-6.0/config.def.h dwm/config.def.h
+--- dwm-6.0/config.def.h 2011-12-19 09:02:46.000000000 -0600
++++ dwm/config.def.h 2012-04-04 22:04:37.895074163 -0500
+_AT_@ -1,17 +1,19 @@
+ /* See LICENSE file for copyright and license details. */
-diff -r 10e232f9ace7 dwm.c
---- a/dwm.c Sun Mar 25 17:49:35 2012 +0200
-+++ b/dwm.c Wed Apr 04 22:18:50 2012 +0200
-_AT_@ -55,12 +55,30 @@
+ /* appearance */
+-static const char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
+-static const char normbordercolor[] = "#444444";
+-static const char normbgcolor[] = "#222222";
+-static const char normfgcolor[] = "#bbbbbb";
+-static const char selbordercolor[] = "#005577";
+-static const char selbgcolor[] = "#005577";
+-static const char selfgcolor[] = "#eeeeee";
+-static const unsigned int borderpx = 1; /* border pixel of windows */
+-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 char font[] = "-*-terminus-medium-r-*-*-16-*-*-*-*-*-*-*";
++static const char normbordercolor[] = "#444444";
++static const char normbgcolor[] = "#222222";
++static const char normfgcolor[] = "#bbbbbb";
++static const char selbordercolor[] = "#005577";
++static const char selbgcolor[] = "#005577";
++static const char selfgcolor[] = "#eeeeee";
++static const unsigned int borderpx = 1; /* border pixel of windows */
++static const unsigned int systrayspacing = 2; /* systray spacing */
++static const Bool showsystray = True;
++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 */
+
+ /* tagging */
+ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+diff -rupN dwm-6.0/dwm.c dwm/dwm.c
+--- dwm-6.0/dwm.c 2011-12-19 09:02:46.000000000 -0600
++++ dwm/dwm.c 2012-04-04 22:02:49.605076986 -0500
+_AT_@ -54,13 +54,30 @@
+ #define HEIGHT(X) ((X)->h + 2 * (X)->bw)
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (textnw(X, strlen(X)) + dc.font.height)
-
-+#define SYSTEM_TRAY_REQUEST_DOCK 0
++#define SYSTEM_TRAY_REQUEST_DOCK 0
+#define _NET_SYSTEM_TRAY_ORIENTATION_HORZ 0
+
+/* XEMBED messages */
_AT_@ -37,13 +55,13 @@
+#define VERSION_MAJOR 0
+#define VERSION_MINOR 0
+#define XEMBED_EMBEDDED_VERSION (VERSION_MAJOR << 16) | VERSION_MINOR
-+
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
-enum { NetSupported, NetWMName, NetWMState,
- NetWMFullscreen, NetActiveWindow, NetWMWindowType,
-- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+- NetWMWindowTypeDialog, NetLast }; /* EWMH atoms */
+enum { NetSupported, NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation,
+ NetWMName, NetWMState, NetWMFullscreen, NetActiveWindow, NetWMWindowType,
+ NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
_AT_@ -51,7 +69,7 @@
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
-_AT_@ -154,6 +172,12 @@
+_AT_@ -154,6 +171,12 @@ typedef struct {
int monitor;
} Rule;
_AT_@ -64,7 +82,7 @@
/* function declarations */
static void applyrules(Client *c);
static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact);
-_AT_@ -186,9 +210,11 @@
+_AT_@ -186,9 +209,11 @@ static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
_AT_@ -76,7 +94,7 @@
static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, Bool focused);
static void grabkeys(void);
-_AT_@ -207,13 +233,16 @@
+_AT_@ -207,13 +232,16 @@ static void pop(Client *);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
_AT_@ -94,7 +112,7 @@
static void sendmon(Client *c, Monitor *m);
static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
-_AT_@ -242,18 +271,24 @@
+_AT_@ -241,18 +269,24 @@ static void updatebars(void);
static void updatenumlockmask(void);
static void updatesizehints(Client *c);
static void updatestatus(void);
_AT_@ -119,7 +137,7 @@
static const char broken[] = "broken";
static char stext[256];
static int screen;
-_AT_@ -275,9 +310,10 @@
+_AT_@ -274,9 +308,10 @@ static void (*handler[LASTEvent]) (XEven
[MapRequest] = maprequest,
[MotionNotify] = motionnotify,
[PropertyNotify] = propertynotify,
_AT_@ -131,7 +149,7 @@
static Bool running = True;
static Cursor cursor[CurLast];
static Display *dpy;
-_AT_@ -498,6 +534,11 @@
+_AT_@ -497,6 +532,11 @@ cleanup(void) {
XFreeCursor(dpy, cursor[CurMove]);
while(mons)
cleanupmon(mons);
_AT_@ -142,8 +160,8 @@
+ }
XSync(dpy, False);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
- XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
-_AT_@ -532,9 +573,48 @@
+ }
+_AT_@ -530,9 +570,48 @@ clearurgent(Client *c) {
void
clientmessage(XEvent *e) {
_AT_@ -192,7 +210,7 @@
if(!c)
return;
if(cme->message_type == netatom[NetWMState]) {
-_AT_@ -585,7 +665,7 @@
+_AT_@ -583,7 +662,7 @@ configurenotify(XEvent *e) {
dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
updatebars();
for(m = mons; m; m = m->next)
_AT_@ -201,7 +219,7 @@
focus(NULL);
arrange(NULL);
}
-_AT_@ -669,6 +749,11 @@
+_AT_@ -667,6 +746,11 @@ destroynotify(XEvent *e) {
if((c = wintoclient(ev->window)))
unmanage(c, True);
_AT_@ -213,7 +231,7 @@
}
void
-_AT_@ -724,6 +809,7 @@
+_AT_@ -722,6 +806,7 @@ drawbar(Monitor *m) {
unsigned long *col;
Client *c;
_AT_@ -221,7 +239,7 @@
for(c = m->clients; c; c = c->next) {
occ |= c->tags;
if(c->isurgent)
-_AT_@ -745,6 +831,9 @@
+_AT_@ -743,6 +828,9 @@ drawbar(Monitor *m) {
if(m == selmon) { /* status is only drawn on selected monitor */
dc.w = TEXTW(stext);
dc.x = m->ww - dc.w;
_AT_@ -231,7 +249,7 @@
if(dc.x < x) {
dc.x = x;
dc.w = m->ww - x;
-_AT_@ -773,6 +862,7 @@
+_AT_@ -771,6 +859,7 @@ drawbars(void) {
for(m = mons; m; m = m->next)
drawbar(m);
_AT_@ -239,7 +257,7 @@
}
void
-_AT_@ -921,10 +1011,17 @@
+_AT_@ -917,10 +1006,17 @@ getatomprop(Client *c, Atom prop) {
unsigned long dl;
unsigned char *p = NULL;
Atom da, atom = None;
_AT_@ -258,7 +276,7 @@
XFree(p);
}
return atom;
-_AT_@ -966,6 +1063,15 @@
+_AT_@ -962,6 +1058,16 @@ getstate(Window w) {
return result;
}
_AT_@ -271,10 +289,11 @@
+ return w ? w + systrayspacing : 1;
+}
+
++
Bool
gettextprop(Window w, Atom atom, char *text, unsigned int size) {
char **list = NULL;
-_AT_@ -1100,7 +1206,7 @@
+_AT_@ -1096,7 +1202,7 @@ void
killclient(const Arg *arg) {
if(!selmon->sel)
return;
_AT_@ -283,7 +302,7 @@
XGrabServer(dpy);
XSetErrorHandler(xerrordummy);
XSetCloseDownMode(dpy, DestroyAll);
-_AT_@ -1186,6 +1292,12 @@
+_AT_@ -1180,6 +1286,12 @@ void
maprequest(XEvent *e) {
static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest;
_AT_@ -296,7 +315,7 @@
if(!XGetWindowAttributes(dpy, ev->window, &wa))
return;
-_AT_@ -1303,6 +1415,16 @@
+_AT_@ -1293,6 +1405,16 @@ propertynotify(XEvent *e) {
Window trans;
XPropertyEvent *ev = &e->xproperty;
_AT_@ -313,7 +332,7 @@
if((ev->window == root) && (ev->atom == XA_WM_NAME))
updatestatus();
else if(ev->state == PropertyDelete)
-_AT_@ -1352,12 +1474,33 @@
+_AT_@ -1342,12 +1464,34 @@ recttomon(int x, int y, int w, int h) {
}
void
_AT_@ -329,6 +348,7 @@
+}
+
+
++
+void
resize(Client *c, int x, int y, int w, int h, Bool interact) {
if(applysizehints(c, &x, &y, &w, &h, interact))
_AT_@ -347,7 +367,7 @@
resizeclient(Client *c, int x, int y, int w, int h) {
XWindowChanges wc;
-_AT_@ -1425,6 +1568,18 @@
+_AT_@ -1412,6 +1556,18 @@ resizemouse(const Arg *arg) {
}
void
_AT_@ -366,7 +386,7 @@
restack(Monitor *m) {
Client *c;
XEvent ev;
-_AT_@ -1508,25 +1663,35 @@
+_AT_@ -1495,25 +1651,35 @@ setclientstate(Client *c, long state) {
}
Bool
_AT_@ -398,12 +418,12 @@
ev.type = ClientMessage;
- ev.xclient.window = c->win;
- ev.xclient.message_type = wmatom[WMProtocols];
-+ ev.xclient.window = w;
-+ ev.xclient.message_type = mt;
ev.xclient.format = 32;
- ev.xclient.data.l[0] = proto;
- ev.xclient.data.l[1] = CurrentTime;
- XSendEvent(dpy, c->win, False, NoEventMask, &ev);
++ ev.xclient.window = w;
++ ev.xclient.message_type = mt;
+ ev.xclient.data.l[0] = d0;
+ ev.xclient.data.l[1] = d1;
+ ev.xclient.data.l[2] = d2;
_AT_@ -413,16 +433,16 @@
}
return exists;
}
-_AT_@ -1539,7 +1704,7 @@
- XA_WINDOW, 32, PropModeReplace,
- (unsigned char *) &(c->win), 1);
- }
+_AT_@ -1522,7 +1688,7 @@ void
+ setfocus(Client *c) {
+ if(!c->neverfocus)
+ XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
- sendevent(c, wmatom[WMTakeFocus]);
+ sendevent(c->win, wmatom[WMTakeFocus], NoEventMask, wmatom[WMTakeFocus], CurrentTime, 0, 0, 0);
}
void
-_AT_@ -1619,12 +1784,18 @@
+_AT_@ -1602,11 +1768,17 @@ setup(void) {
wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
_AT_@ -434,14 +454,13 @@
netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", 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);
+ xatom[Manager] = XInternAtom(dpy, "MANAGER", False);
+ xatom[Xembed] = XInternAtom(dpy, "_XEMBED", False);
+ xatom[XembedInfo] = XInternAtom(dpy, "_XEMBED_INFO", False);
/* init cursors */
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
-_AT_@ -1641,6 +1812,8 @@
+_AT_@ -1623,6 +1795,8 @@ setup(void) {
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
if(!dc.font.set)
XSetFont(dpy, dc.gc, dc.font.xfont->fid);
_AT_@ -450,7 +469,7 @@
/* init bars */
updatebars();
updatestatus();
-_AT_@ -1750,7 +1923,18 @@
+_AT_@ -1731,7 +1905,18 @@ void
togglebar(const Arg *arg) {
selmon->showbar = !selmon->showbar;
updatebarpos(selmon);
_AT_@ -470,7 +489,7 @@
arrange(selmon);
}
-_AT_@ -1840,11 +2024,18 @@
+_AT_@ -1816,10 +2001,16 @@ unmapnotify(XEvent *e) {
else
unmanage(c, False);
}
_AT_@ -485,14 +504,12 @@
updatebars(void) {
+ unsigned int w;
Monitor *m;
-+
XSetWindowAttributes wa = {
.override_redirect = True,
- .background_pixmap = ParentRelative,
-_AT_@ -1853,7 +2044,10 @@
+_AT_@ -1827,7 +2018,10 @@ updatebars(void) {
+ .event_mask = ButtonPressMask|ExposureMask
+ };
for(m = mons; m; m = m->next) {
- if (m->barwin)
- continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
+ w = m->ww;
+ if(showsystray && m == selmon)
_AT_@ -501,7 +518,7 @@
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
-_AT_@ -2050,6 +2244,104 @@
+_AT_@ -2011,6 +2205,104 @@ updatestatus(void) {
}
void
_AT_@ -606,7 +623,7 @@
updatewindowtype(Client *c) {
Atom state = getatomprop(c, netatom[NetWMState]);
Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
-_AT_@ -2118,6 +2410,16 @@
+_AT_@ -2080,6 +2372,16 @@ wintomon(Window w) {
return selmon;
}
diff -r 678e8e9bafba -r 81211036de44 dwm.suckless.org/patches/systray.md
--- a/dwm.suckless.org/patches/systray.md Wed Apr 04 22:21:45 2012 +0200
+++ b/dwm.suckless.org/patches/systray.md Thu Apr 05 12:15:12 2012 -0500
_AT_@ -8,7 +8,7 @@
Download
--------
-* [dwm-6.0-systray.diff](dwm-6.0-systray.diff) (18K) (20120404)
+* [dwm-6.0-systray.diff](dwm-6.0-systray.diff) (20K) (20120405)
Author
------
Received on Thu Apr 05 2012 - 19:24:43 CEST