Commits

Anonymous committed 5aad536

raise system tray when executing updatesystray

- when switching between multiple monitors the system tray stayed in the back sometimes

  • Participants
  • Parent commits 3f58fd6

Comments (0)

Files changed (1)

File systray.patch

 URL: http://dwm.suckless.org/patches/systray
 Implements a system tray for dwm.
 
-diff -r f558df315157 config.def.h
---- a/config.def.h	Wed Apr 04 08:40:36 2012 +0200
-+++ b/config.def.h	Wed Apr 04 12:56:05 2012 +0200
+diff -r 321da39fe7ef config.def.h
+--- a/config.def.h	Sun Aug 05 19:24:49 2012 +0200
++++ b/config.def.h	Sun Aug 05 20:04:57 2012 +0200
 @@ -12,6 +12,8 @@
  static const char floatselbordercolor[]  = "#ff0000";
  static const unsigned int borderpx  = 1;        /* border pixel of windows */
  static const Bool showbar           = True;     /* False means no bar */
  static const Bool topbar            = True;     /* False means bottom bar */
  
-diff -r f558df315157 dwm.c
---- a/dwm.c	Wed Apr 04 08:40:36 2012 +0200
-+++ b/dwm.c	Wed Apr 04 12:56:05 2012 +0200
-@@ -55,12 +55,30 @@
+diff -r 321da39fe7ef dwm.c
+--- a/dwm.c	Sun Aug 05 19:24:49 2012 +0200
++++ b/dwm.c	Sun Aug 05 20:04:57 2012 +0200
+@@ -56,12 +56,30 @@
  #define TAGMASK                 ((1 << LENGTH(tags)) - 1)
  #define TEXTW(X)                (textnw(X, strlen(X)) + dc.font.height)
  
  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
  enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
         ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
-@@ -157,6 +175,12 @@
+@@ -158,6 +176,12 @@
  	int monitor;
  } Rule;
  
  struct Clientlist {
  	Client *clients;
  	Client *stack;
-@@ -196,9 +220,11 @@
+@@ -197,9 +221,11 @@
  static void focusin(XEvent *e);
  static void focusmon(const Arg *arg);
  static void focusstack(const Arg *arg);
  static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
  static void grabbuttons(Client *c, Bool focused);
  static void grabkeys(void);
-@@ -217,13 +243,16 @@
+@@ -218,13 +244,16 @@
  static void propertynotify(XEvent *e);
  static void quit(const Arg *arg);
  static Monitor *recttomon(int x, int y, int w, int h);
  static void sendmon(Client *c, Monitor *m);
  static void setclientstate(Client *c, long state);
  static void setfocus(Client *c);
-@@ -253,18 +282,24 @@
+@@ -254,18 +283,24 @@
  static void updatenumlockmask(void);
  static void updatesizehints(Client *c);
  static void updatestatus(void);
  static Client *prevclient = NULL;
  static Client *prevzoom = NULL;
  static const char broken[] = "broken";
-@@ -288,9 +323,10 @@
+@@ -289,9 +324,10 @@
  	[MapRequest] = maprequest,
  	[MotionNotify] = motionnotify,
  	[PropertyNotify] = propertynotify,
  static Bool running = True;
  static Cursor cursor[CurLast];
  static Display *dpy;
-@@ -567,6 +603,11 @@
+@@ -568,6 +604,11 @@
  	XFreeCursor(dpy, cursor[CurMove]);
  	while(mons)
  		cleanupmon(mons);
  	XSync(dpy, False);
  	XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
  	XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
-@@ -601,9 +642,48 @@
+@@ -602,9 +643,48 @@
  
  void
  clientmessage(XEvent *e) {
  	if(!c)
  		return;
  	if(cme->message_type == netatom[NetWMState]) {
-@@ -654,7 +734,7 @@
+@@ -656,7 +736,7 @@
  			dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
  			updatebars();
  			for(m = mons; m; m = m->next)
  			focus(NULL);
  			arrange(NULL);
  		}
-@@ -763,6 +843,11 @@
+@@ -765,6 +845,11 @@
  
  	if((c = wintoclient(ev->window)))
  		unmanage(c, True);
  }
  
  void
-@@ -818,6 +903,7 @@
+@@ -820,6 +905,7 @@
  	unsigned long *col;
  	Client *c;
  
  	for(c = m->cl->clients; c; c = c->next) {
  		occ |= c->tags;
  		if(c->isurgent)
-@@ -838,6 +924,9 @@
+@@ -840,6 +926,9 @@
  	x = dc.x;
  	dc.w = TEXTW(stext);
  	dc.x = m->ww - dc.w;
  	if(dc.x < x) {
  		dc.x = x;
  		dc.w = m->ww - x;
-@@ -863,6 +952,7 @@
+@@ -865,6 +954,7 @@
  
  	for(m = mons; m; m = m->next)
  		drawbar(m);
  }
  
  void
-@@ -1014,10 +1104,17 @@
+@@ -1017,10 +1107,17 @@
  	unsigned long dl;
  	unsigned char *p = NULL;
  	Atom da, atom = None;
  		XFree(p);
  	}
  	return atom;
-@@ -1064,6 +1161,15 @@
+@@ -1062,6 +1159,15 @@
  	return result;
  }
  
  Bool
  gettextprop(Window w, Atom atom, char *text, unsigned int size) {
  	char **list = NULL;
-@@ -1198,7 +1304,7 @@
+@@ -1196,7 +1302,7 @@
  killclient(const Arg *arg) {
  	if(!selmon->sel)
  		return;
  		XGrabServer(dpy);
  		XSetErrorHandler(xerrordummy);
  		XSetCloseDownMode(dpy, DestroyAll);
-@@ -1292,6 +1398,12 @@
+@@ -1290,6 +1396,12 @@
  maprequest(XEvent *e) {
  	static XWindowAttributes wa;
  	XMapRequestEvent *ev = &e->xmaprequest;
  
  	if(!XGetWindowAttributes(dpy, ev->window, &wa))
  		return;
-@@ -1418,6 +1530,16 @@
+@@ -1415,6 +1527,16 @@
  	Window trans;
  	XPropertyEvent *ev = &e->xproperty;
  
  	if((ev->window == root) && (ev->atom == XA_WM_NAME))
  		updatestatus();
  	else if(ev->state == PropertyDelete)
-@@ -1467,12 +1589,33 @@
+@@ -1464,12 +1586,33 @@
  }
  
  void
  resizeclient(Client *c, int x, int y, int w, int h) {
  	XWindowChanges wc;
  
-@@ -1540,6 +1683,18 @@
+@@ -1536,6 +1679,18 @@
  }
  
  void
  restack(Monitor *m) {
  	Client *c;
  	XEvent ev;
-@@ -1621,25 +1776,35 @@
+@@ -1617,25 +1772,35 @@
  }
  
  Bool
  	}
  	return exists;
  }
-@@ -1652,7 +1817,7 @@
+@@ -1648,7 +1813,7 @@
   		                XA_WINDOW, 32, PropModeReplace,
   		                (unsigned char *) &(c->win), 1);
  	}
  }
  
  void
-@@ -1737,12 +1902,18 @@
+@@ -1733,12 +1898,18 @@
  	wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
  	netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
  	netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
  	/* init cursors */
  	cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
  	cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
-@@ -1761,6 +1932,8 @@
+@@ -1757,6 +1928,8 @@
  	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
  	if(!dc.font.set)
  		XSetFont(dpy, dc.gc, dc.font.xfont->fid);
  	/* init bars */
  	updatebars();
  	updatestatus();
-@@ -1904,7 +2077,18 @@
+@@ -1908,7 +2081,18 @@
  togglebar(const Arg *arg) {
  	selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
  	updatebarpos(selmon);
  	arrange(selmon);
  }
  
-@@ -2047,11 +2231,18 @@
+@@ -2051,11 +2235,18 @@
  		else
  			unmanage(c, False);
  	}
  	XSetWindowAttributes wa = {
  		.override_redirect = True,
  		.background_pixmap = ParentRelative,
-@@ -2060,7 +2251,10 @@
+@@ -2064,7 +2255,10 @@
  	for(m = mons; m; m = m->next) {
  		if (m->barwin)
  			continue;
  		                          CopyFromParent, DefaultVisual(dpy, screen),
  		                          CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
  		XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
-@@ -2257,6 +2451,104 @@
+@@ -2261,6 +2455,105 @@
  }
  
  void
 +	w = w ? w + systrayspacing : 1;
 + 	x -= w;
 +	XMoveResizeWindow(dpy, systray->win, x, selmon->by, w, bh);
++	XMapRaised(dpy, systray->win);
 +	XSync(dpy, False);
 +}
 +
  updatewindowtype(Client *c) {
  	Atom state = getatomprop(c, netatom[NetWMState]);
  	Atom wtype = getatomprop(c, netatom[NetWMWindowType]);
-@@ -2367,6 +2659,16 @@
+@@ -2371,6 +2664,16 @@
  	return selmon;
  }