conformal / spectrwm

A small dynamic tiling window manager for X11.
ISC License
1.33k stars 97 forks source link

iconic_enabled: value '2' to always show the iconic count (diff included) #27

Closed levaidaniel closed 10 years ago

levaidaniel commented 10 years ago

I like to have the iconified count always displayed, regardless of how many there are. It is like it's acting as a placeholder in the status bar with {0} if there are none (or no windows at all). A bit like the urgent_enabled option always displaying the list of dashes corresponding to workspaces, no matter if they have an urgent window or not.

Although it works for me, I'm a bit worried about this aproach, it could be just Plain Wrong(tm), so suggestions are welcome.

--- spectrwm.c.orig     2013-11-27 10:23:33.321907539 +0100
+++ spectrwm.c  2013-11-27 10:33:32.279889689 +0100
@@ -2099,13 +2099,17 @@ bar_fmt(const char *fmtexp, char *fmtnew
        if (r != NULL && r->ws != NULL && r->ws->name != NULL)
                strlcat(fmtnew, "<+D>", sz);

-       /* If enabled, only show the iconic count if there are iconic wins. */
-       if (iconic_enabled && r != NULL && r->ws != NULL)
+       /* If set to 1, only show the iconic count if there are iconic wins. */
+       if (iconic_enabled == 1 && r != NULL && r->ws != NULL) {
                TAILQ_FOREACH(w, &r->ws->winlist, entry)
                        if (w->iconic) {
                                strlcat(fmtnew, "{+M}", sz);
                                break;
                        }
+       } else if (iconic_enabled == 2 && r != NULL && r->ws != NULL) {
+       /* If set to 2, always show the iconic count. */
+               strlcat(fmtnew, "{+M}", sz);
+       }

        strlcat(fmtnew, "+3<", sz);

LordReg commented 10 years ago

It's already possible with a custom bar_format. For example: bar_format = +N:+I +S <+D>{+M} %a %b %d %R %Z %Y * +U* +C:+T +F +64W +A +V

levaidaniel commented 10 years ago

Yeah, good point! Funny thing is, that I enjoy not having the empty <> dangling before {+M}, if the workspace was not named. But now that I think of it, this could be the case for every single option's value that is not displayed if it's empty or zero (and while not using bar_format, just the individual *_enabled options), so doing this with only iconic_enabled is not right nor worth it. So... I guess I'll just pretend this didn't happen :-)