Hi,

Just a proposal. I like to prevent selected programs (like xclock,
xbiff, xload) from filling up the taskbar (tint2 in my case) and added a
while ago a function that lets me set the EWMH flag
_NET_WM_STATE_SKIP_TASKBAR through a key binding (MS-t).
Also, since cycling in cwm can get hairy when there are a lot of windows
open, I added a function that emulates the EWMH flag
_NET_WM_STATE_SKIP_PAGER and assigned this to a key binding (MS-p) as
well.
The latter has proven quite useful for programs that one would want to
have hanging around - possibly with the sticky/frozen bit set - but
without interfering with the window cycling flow.

A somewhat crude diff included below for those interested.

Erling

-- 
Erling Westenvik


Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.333
diff -u -p -r1.333 calmwm.h
--- calmwm.h    15 Nov 2016 00:22:02 -0000      1.333
+++ calmwm.h    1 Dec 2016 15:50:38 -0000
@@ -156,6 +156,8 @@ struct client_ctx {
 #define CLIENT_FULLSCREEN              0x0800
 #define CLIENT_STICKY                  0x1000
 #define CLIENT_ACTIVE                  0x2000
+#define CLIENT_SKIP_TASKBAR            0x4000
+#define CLIENT_SKIP_PAGER              0x8000
 
 #define CLIENT_HIGHLIGHT               (CLIENT_GROUP | CLIENT_UNGROUP)
 #define CLIENT_MAXFLAGS                        (CLIENT_VMAXIMIZED | 
CLIENT_HMAXIMIZED)
@@ -360,6 +362,7 @@ enum ewmh {
        _NET_WM_STATE_HIDDEN,
        _NET_WM_STATE_FULLSCREEN,
        _NET_WM_STATE_DEMANDS_ATTENTION,
+       _NET_WM_STATE_SKIP_TASKBAR,
        _CWM_WM_STATE_FREEZE,
        EWMH_NITEMS
 };
@@ -409,6 +412,8 @@ int                  client_snapcalc(int, int, int, in
 void                    client_toggle_freeze(struct client_ctx *);
 void                    client_toggle_fullscreen(struct client_ctx *);
 void                    client_toggle_hidden(struct client_ctx *);
+void                    client_toggle_skip_taskbar(struct client_ctx *);
+void                    client_toggle_skip_pager(struct client_ctx *);
 void                    client_toggle_hmaximize(struct client_ctx *);
 void                    client_toggle_maximize(struct client_ctx *);
 void                    client_toggle_sticky(struct client_ctx *);
@@ -470,6 +475,8 @@ void                         kbfunc_client_raise(void *, 
unio
 void                    kbfunc_client_hide(void *, union arg *, enum xev);
 void                    kbfunc_client_toggle_freeze(void *,
                             union arg *, enum xev);
+void                    kbfunc_client_toggle_skip_taskbar(void *, union arg *, 
enum xev);
+void                    kbfunc_client_toggle_skip_pager(void *, union arg *, 
enum xev);
 void                    kbfunc_client_toggle_sticky(void *,
                             union arg *, enum xev);
 void                    kbfunc_client_toggle_fullscreen(void *,
Index: client.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.230
diff -u -p -r1.230 client.c
--- client.c    18 Oct 2016 17:03:30 -0000      1.230
+++ client.c    1 Dec 2016 15:50:39 -0000
@@ -257,6 +257,24 @@ client_toggle_freeze(struct client_ctx *
 }
 
 void
+client_toggle_skip_taskbar(struct client_ctx *cc)
+{
+       if (cc->flags & CLIENT_SKIP_TASKBAR)
+               cc->flags &= ~CLIENT_SKIP_TASKBAR;
+       else
+               cc->flags |= CLIENT_SKIP_TASKBAR;
+
+       xu_ewmh_set_net_wm_state(cc);
+}
+
+void
+client_toggle_skip_pager(struct client_ctx *cc)
+{
+       cc->flags ^= CLIENT_SKIP_PAGER;
+       xu_ewmh_set_net_wm_state(cc);
+}
+
+void
 client_toggle_hidden(struct client_ctx *cc)
 {
        cc->flags ^= CLIENT_HIDDEN;
@@ -665,7 +683,7 @@ client_cycle(struct screen_ctx *sc, int 
                    client_next(newcc);
 
                /* Only cycle visible and non-ignored windows. */
-               if ((newcc->flags & (CLIENT_HIDDEN | CLIENT_IGNORE))
+               if ((newcc->flags & (CLIENT_HIDDEN | CLIENT_IGNORE | 
CLIENT_SKIP_PAGER))
                    || ((flags & CWM_CYCLE_INGROUP) &&
                        (newcc->gc != oldcc->gc)))
                        again = 1;
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.224
diff -u -p -r1.224 conf.c
--- conf.c      15 Nov 2016 00:22:02 -0000      1.224
+++ conf.c      1 Dec 2016 15:50:39 -0000
@@ -110,6 +110,8 @@ static const struct {
            {.i = (CWM_CYCLE_REVERSE | CWM_CYCLE_INGROUP)} },
        { "grouptoggle", kbfunc_client_toggle_group, CWM_CONTEXT_CC, {0} },
        { "stick", kbfunc_client_toggle_sticky, CWM_CONTEXT_CC, {0} },
+       { "skip_taskbar", kbfunc_client_toggle_skip_taskbar, CWM_CONTEXT_CC, 
{0} },
+       { "skip_pager", kbfunc_client_toggle_skip_pager, CWM_CONTEXT_CC, {0} },
        { "fullscreen", kbfunc_client_toggle_fullscreen, CWM_CONTEXT_CC, {0} },
        { "maximize", kbfunc_client_toggle_maximize, CWM_CONTEXT_CC, {0} },
        { "vmaximize", kbfunc_client_toggle_vmaximize, CWM_CONTEXT_CC, {0} },
@@ -681,6 +683,7 @@ static char *ewmhints[] = {
        "_NET_WM_STATE_HIDDEN",
        "_NET_WM_STATE_FULLSCREEN",
        "_NET_WM_STATE_DEMANDS_ATTENTION",
+       "_NET_WM_STATE_SKIP_TASKBAR",
        "_CWM_WM_STATE_FREEZE",
 };
 
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.137
diff -u -p -r1.137 kbfunc.c
--- kbfunc.c    15 Nov 2016 18:43:09 -0000      1.137
+++ kbfunc.c    1 Dec 2016 15:50:39 -0000
@@ -205,6 +205,18 @@ kbfunc_client_toggle_sticky(void *ctx, u
 }
 
 void
+kbfunc_client_toggle_skip_taskbar(void *ctx, union arg *arg, enum xev xev)
+{
+       client_toggle_skip_taskbar(ctx);
+}
+
+void
+kbfunc_client_toggle_skip_pager(void *ctx, union arg *arg, enum xev xev)
+{
+       client_toggle_skip_pager(ctx);
+}
+
+void
 kbfunc_client_toggle_fullscreen(void *ctx, union arg *arg, enum xev xev)
 {
        client_toggle_fullscreen(ctx);
Index: xutil.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/xutil.c,v
retrieving revision 1.108
diff -u -p -r1.108 xutil.c
--- xutil.c     5 Oct 2016 13:10:59 -0000       1.108
+++ xutil.c     1 Dec 2016 15:50:39 -0000
@@ -368,6 +368,9 @@ xu_ewmh_handle_net_wm_state_msg(struct c
                { _NET_WM_STATE_DEMANDS_ATTENTION,
                        CLIENT_URGENCY,
                        client_urgency },
+               { _NET_WM_STATE_SKIP_TASKBAR,
+                       CLIENT_SKIP_TASKBAR,
+                       client_toggle_skip_taskbar},
                { _CWM_WM_STATE_FREEZE,
                        CLIENT_FREEZE,
                        client_toggle_freeze },
@@ -410,6 +413,8 @@ xu_ewmh_restore_net_wm_state(struct clie
                        client_toggle_hidden(cc);
                if (atoms[i] == ewmh[_NET_WM_STATE_FULLSCREEN])
                        client_toggle_fullscreen(cc);
+               if (atoms[i] == ewmh[_NET_WM_STATE_SKIP_TASKBAR])
+                       client_toggle_skip_taskbar(cc);
                if (atoms[i] == ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
                        client_urgency(cc);
                if (atoms[i] == ewmh[_CWM_WM_STATE_FREEZE])
@@ -432,6 +437,7 @@ xu_ewmh_set_net_wm_state(struct client_c
                    oatoms[i] != ewmh[_NET_WM_STATE_MAXIMIZED_HORZ] &&
                    oatoms[i] != ewmh[_NET_WM_STATE_HIDDEN] &&
                    oatoms[i] != ewmh[_NET_WM_STATE_FULLSCREEN] &&
+                   oatoms[i] != ewmh[_NET_WM_STATE_SKIP_TASKBAR] &&
                    oatoms[i] != ewmh[_NET_WM_STATE_DEMANDS_ATTENTION] &&
                    oatoms[i] != ewmh[_CWM_WM_STATE_FREEZE])
                        atoms[j++] = oatoms[i];
@@ -451,6 +457,8 @@ xu_ewmh_set_net_wm_state(struct client_c
        }
        if (cc->flags & CLIENT_URGENCY)
                atoms[j++] = ewmh[_NET_WM_STATE_DEMANDS_ATTENTION];
+       if (cc->flags & CLIENT_SKIP_TASKBAR)
+               atoms[j++] = ewmh[_NET_WM_STATE_SKIP_TASKBAR];
        if (cc->flags & CLIENT_FREEZE)
                atoms[j++] = ewmh[_CWM_WM_STATE_FREEZE];
        if (j > 0)

Reply via email to