On Fri, Dec 02, 2016 at 03:17:05PM -0500, Okan Demirmen wrote:
> On Fri 2016.12.02 at 11:15 +0100, Erling Westenvik wrote:
> > On Thu, Dec 01, 2016 at 12:26:36PM -0500, Okan Demirmen wrote:
> > > On Thu 2016.12.01 at 17:25 +0100, Erling Westenvik wrote:
> > > > 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.
> > >
> > > Thanks for the patch. I've been asked about this before and it's on my
> > > list,
> > > but you've gotten to it before me - thanks! However, it'd be more
> > > interesting
> > > to treat these like we treat 'ignore' today, so that these clients can be
> > > placed in the config and skipped everytime. I haven't yet looked at what
> > > others
> > > wm's do - runtime marking of windows or config-based.
> >
> > I'd suggest both config-based and runtime marking and will take a stab
> > at config-based marking this weekend.
> > I can see that it may be inapropriate to include this functionality into
> > cwm. The only reason I put it into the source is that I could not
> > achieve the same results with wmctrl(1). (Wmctrl is able to set
> > _NET_WM_STATE_SKIP_PAGER but cwm doesn't seem to honor the atom.)
> > As for other wm's I'm not aware of any that offers exactly this kind of
> > functionality. Perhaps windowmaker or enlightement? But it's not an
> > option for me anyway since I've fallen in love with cwm.
>
> Sure, doing both runtime marking and config-based would be OK too. This does
> of
> course bring up the bits about 'ignore' - should skipping pager/taskbar imply
> the same things as 'ignore', such as borders? And you bring up sticking,
> position/geometry-wise too...I don't know. Maybe 'ignore' is what
> 'skip-taskbar/pager' is about? (and if so, just need to hook up the netwm bits
> to 'ignore' instead, and make that runtime).
>
> I don't use 'ignore' or any pager/taskbar, so I'm unsure; thus why I was going
> to look at other wm's behaviour on this front. I'm not opposed to adding some
> set of features in this area, especially since it's related to ewmh. There are
> others in that spec that I'm looking at as well.
>
> BTW, here's a complete patch for both taskbar and pager, based on the one you
> submitted. It's just runtime tagging, as your original one did.
*embarressed* Since I'm not using a pager myself, I started to mix
things here. EWMH's *_SKIP_PAGER doesn't have anything to do with window
cycling of course, and if my patch is to be considered,
CLIENT_SKIP_PAGER should probably be renamed to CLIENT_SKIP_CYCLE (along
with its respective function references).
While I'd be happy to see my proposals implemented I also realize that
they may be considered more like "tweaks" beyond the scope of "pure"
cwm. After all, I'm stealing two flags here.
Suggest taking this off list until further?
Thanks,
Erling
>
> Thanks,
> Okan
>
> Index: calmwm.h
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.335
> diff -u -p -r1.335 calmwm.h
> --- calmwm.h 1 Dec 2016 20:28:19 -0000 1.335
> +++ calmwm.h 2 Dec 2016 19:50:45 -0000
> @@ -156,7 +156,11 @@ 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_SKIP_CYCLE (CLIENT_HIDDEN | CLIENT_IGNORE | \
> + CLIENT_SKIP_TASKBAR |
> CLIENT_SKIP_PAGER)
> #define CLIENT_HIGHLIGHT (CLIENT_GROUP | CLIENT_UNGROUP)
> #define CLIENT_MAXFLAGS (CLIENT_VMAXIMIZED |
> CLIENT_HMAXIMIZED)
> #define CLIENT_MAXIMIZED (CLIENT_VMAXIMIZED | CLIENT_HMAXIMIZED)
> @@ -355,13 +359,15 @@ enum ewmh {
> _NET_WM_DESKTOP,
> _NET_CLOSE_WINDOW,
> _NET_WM_STATE,
> -#define _NET_WM_STATES_NITEMS 7
> +#define _NET_WM_STATES_NITEMS 9
> _NET_WM_STATE_STICKY,
> _NET_WM_STATE_MAXIMIZED_VERT,
> _NET_WM_STATE_MAXIMIZED_HORZ,
> _NET_WM_STATE_HIDDEN,
> _NET_WM_STATE_FULLSCREEN,
> _NET_WM_STATE_DEMANDS_ATTENTION,
> + _NET_WM_STATE_SKIP_TASKBAR,
> + _NET_WM_STATE_SKIP_PAGER,
> _CWM_WM_STATE_FREEZE,
> EWMH_NITEMS
> };
> @@ -411,6 +417,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 *);
> @@ -469,6 +477,10 @@ void kbfunc_client_lower(void *,
> unio
> void kbfunc_client_raise(void *, union arg *, enum xev);
> 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);
> Index: client.c
> ===================================================================
> RCS file: /home/open/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 2 Dec 2016 19:51:03 -0000
> @@ -257,6 +257,20 @@ client_toggle_freeze(struct client_ctx *
> }
>
> void
> +client_toggle_skip_taskbar(struct client_ctx *cc)
> +{
> + 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 +679,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_SKIP_CYCLE))
> || ((flags & CWM_CYCLE_INGROUP) &&
> (newcc->gc != oldcc->gc)))
> again = 1;
> Index: conf.c
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v
> retrieving revision 1.228
> diff -u -p -r1.228 conf.c
> --- conf.c 2 Dec 2016 17:02:17 -0000 1.228
> +++ conf.c 2 Dec 2016 20:12:22 -0000
> @@ -73,6 +73,8 @@ static const struct {
> { "window-maximize", kbfunc_client_toggle_maximize, CWM_CONTEXT_CC, {0}
> },
> { "window-vmaximize", kbfunc_client_toggle_vmaximize, CWM_CONTEXT_CC,
> {0} },
> { "window-hmaximize", kbfunc_client_toggle_hmaximize, CWM_CONTEXT_CC,
> {0} },
> + { "window-skip-taskbar", kbfunc_client_toggle_skip_taskbar,
> CWM_CONTEXT_CC, {0} },
> + { "window-skip-pager", kbfunc_client_toggle_skip_pager, CWM_CONTEXT_CC,
> {0} },
> { "window-freeze", kbfunc_client_toggle_freeze, CWM_CONTEXT_CC, {0} },
> { "window-cycle", kbfunc_client_cycle, CWM_CONTEXT_SC,
> {.i = (CWM_CYCLE_FORWARD)} },
> @@ -696,6 +698,8 @@ static char *ewmhints[] = {
> "_NET_WM_STATE_HIDDEN",
> "_NET_WM_STATE_FULLSCREEN",
> "_NET_WM_STATE_DEMANDS_ATTENTION",
> + "_NET_WM_STATE_SKIP_TASKBAR",
> + "_NET_WM_STATE_SKIP_PAGER",
> "_CWM_WM_STATE_FREEZE",
> };
>
> Index: cwmrc.5
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/cwmrc.5,v
> retrieving revision 1.65
> diff -u -p -r1.65 cwmrc.5
> --- cwmrc.5 1 Dec 2016 18:17:52 -0000 1.65
> +++ cwmrc.5 2 Dec 2016 20:02:31 -0000
> @@ -311,6 +311,10 @@ Lower current window.
> Raise current window.
> .It window-menu-label
> Label current window.
> +.It window-skip-taskbar
> +Tag window so it is skipped by cycling and a taskbar.
> +.It window-skip-pager
> +Tag window so it is skipped by cycling and a pager.
> .It window-freeze
> Freeze current window geometry.
> .It window-stick
> Index: kbfunc.c
> ===================================================================
> RCS file: /home/open/cvs/xenocara/app/cwm/kbfunc.c,v
> retrieving revision 1.140
> diff -u -p -r1.140 kbfunc.c
> --- kbfunc.c 1 Dec 2016 20:28:19 -0000 1.140
> +++ kbfunc.c 2 Dec 2016 19:41:25 -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: /home/open/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 2 Dec 2016 19:49:02 -0000
> @@ -368,6 +368,12 @@ 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},
> + { _NET_WM_STATE_SKIP_PAGER,
> + CLIENT_SKIP_PAGER,
> + client_toggle_skip_pager},
> { _CWM_WM_STATE_FREEZE,
> CLIENT_FREEZE,
> client_toggle_freeze },
> @@ -410,6 +416,10 @@ 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_SKIP_PAGER])
> + client_toggle_skip_pager(cc);
> if (atoms[i] == ewmh[_NET_WM_STATE_DEMANDS_ATTENTION])
> client_urgency(cc);
> if (atoms[i] == ewmh[_CWM_WM_STATE_FREEZE])
> @@ -432,6 +442,8 @@ 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_SKIP_PAGER] &&
> oatoms[i] != ewmh[_NET_WM_STATE_DEMANDS_ATTENTION] &&
> oatoms[i] != ewmh[_CWM_WM_STATE_FREEZE])
> atoms[j++] = oatoms[i];
> @@ -451,6 +463,10 @@ 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_SKIP_PAGER)
> + atoms[j++] = ewmh[_NET_WM_STATE_SKIP_PAGER];
> if (cc->flags & CLIENT_FREEZE)
> atoms[j++] = ewmh[_CWM_WM_STATE_FREEZE];
> if (j > 0)