summaryrefslogtreecommitdiff
path: root/tabbed.c
diff options
context:
space:
mode:
Diffstat (limited to 'tabbed.c')
-rw-r--r--tabbed.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/tabbed.c b/tabbed.c
index 93c9d0f..ba69f21 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -129,6 +129,7 @@ static void setcmd(int argc, char *argv[], int);
static void sigchld(int unused);
static void spawn(const Arg *arg);
static int textnw(const char *text, unsigned int len);
+static void toggle(const Arg *arg);
static void unmanage(int c);
static void updatenumlockmask(void);
static void updatetitle(int c);
@@ -837,12 +838,21 @@ propertynotify(const XEvent *e) {
&& (c = getclient(ev->window)) > -1
&& (wmh = XGetWMHints(dpy, clients[c]->win))) {
if(wmh->flags & XUrgencyHint) {
+ XFree(wmh);
+ wmh = XGetWMHints(dpy, win);
if(c != sel) {
- clients[c]->urgent = True;
- drawbar();
+ if(urgentswitch && wmh && !(wmh->flags & XUrgencyHint)) {
+ /* only switch, if tabbed was focused since last urgency hint
+ * if WMHints could not be received, default to no switch */
+ focus(c);
+ } else {
+ /* if no switch should be performed, mark tab as urgent */
+ clients[c]->urgent = True;
+ drawbar();
+ }
}
- XFree(wmh);
- if((wmh = XGetWMHints(dpy, win))) {
+ if(wmh && !(wmh->flags & XUrgencyHint)) {
+ /* update tabbed urgency hint if not set already */
wmh->flags |= XUrgencyHint;
XSetWMHints(dpy, win, wmh);
}
@@ -1094,6 +1104,11 @@ textnw(const char *text, unsigned int len) {
}
void
+toggle(const Arg *arg) {
+ *(Bool*) arg->v = !*(Bool*) arg->v;
+}
+
+void
unmanage(int c) {
if(c < 0 || c >= nclients) {
drawbar();