summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2bf2ca8)
When one or more windows are iconic, show the count in bar.
Add new bar_format character sequence: +M
Replaced with iconic window count.
Closes #19
.It Li "+D" Ta "Workspace name"
.It Li "+F" Ta "Floating indicator"
.It Li "+I" Ta "Workspace index"
.It Li "+D" Ta "Workspace name"
.It Li "+F" Ta "Floating indicator"
.It Li "+I" Ta "Workspace index"
+.It Li "+M" Ta "Number of iconic (minimized) windows in workspace"
.It Li "+N" Ta "Screen number"
.It Li "+P" Ta "Window class and instance separated by a colon"
.It Li "+S" Ta "Stacking algorithm"
.It Li "+N" Ta "Screen number"
.It Li "+P" Ta "Window class and instance separated by a colon"
.It Li "+S" Ta "Stacking algorithm"
so a custom clock could be used in the
.Pa bar_action
script.
so a custom clock could be used in the
.Pa bar_action
script.
+.It Ic iconic_enabled
+Display the number of iconic (minimized) windows in the status bar.
+Enable by setting to 1.
.It Ic color_focus
Border color of the currently focussed window.
.It Ic color_unfocus
.It Ic color_focus
Border color of the currently focussed window.
.It Ic color_unfocus
char *bar_format = NULL;
int stack_enabled = 1;
int clock_enabled = 1;
char *bar_format = NULL;
int stack_enabled = 1;
int clock_enabled = 1;
int urgent_enabled = 0;
char *clock_format = NULL;
int window_class_enabled = 0;
int urgent_enabled = 0;
char *clock_format = NULL;
int window_class_enabled = 0;
void
bar_fmt(const char *fmtexp, char *fmtnew, struct swm_region *r, size_t sz)
{
void
bar_fmt(const char *fmtexp, char *fmtnew, struct swm_region *r, size_t sz)
{
/* if format provided, just copy the buffers */
if (bar_format != NULL) {
strlcpy(fmtnew, fmtexp, sz);
/* if format provided, just copy the buffers */
if (bar_format != NULL) {
strlcpy(fmtnew, fmtexp, sz);
/* only show the workspace name if there's actually one */
if (r != NULL && r->ws != NULL && r->ws->name != NULL)
strlcat(fmtnew, "<+D>", sz);
/* only show the workspace name if there's actually one */
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)
+ TAILQ_FOREACH(w, &r->ws->winlist, entry)
+ if (w->iconic) {
+ strlcat(fmtnew, "{+M}", sz);
+ break;
+ }
+
strlcat(fmtnew, "+3<", sz);
if (clock_enabled) {
strlcat(fmtnew, "+3<", sz);
if (clock_enabled) {
bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep,
size_t sz)
{
bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep,
size_t sz)
{
char *ptr;
char tmp[SWM_BAR_MAX];
char *ptr;
char tmp[SWM_BAR_MAX];
+ int limit, size, count;
size_t len;
/* reset strlcat(3) buffer */
size_t len;
/* reset strlcat(3) buffer */
case 'I':
snprintf(tmp, sizeof tmp, "%d", r->ws->idx + 1);
break;
case 'I':
snprintf(tmp, sizeof tmp, "%d", r->ws->idx + 1);
break;
+ case 'M':
+ count = 0;
+ TAILQ_FOREACH(w, &r->ws->winlist, entry)
+ if (w->iconic)
+ ++count;
+
+ snprintf(tmp, sizeof tmp, "%d", count);
+ break;
case 'N':
snprintf(tmp, sizeof tmp, "%d", r->s->idx + 1);
break;
case 'N':
snprintf(tmp, sizeof tmp, "%d", r->s->idx + 1);
break;
SWM_S_FOCUS_CLOSE_WRAP,
SWM_S_FOCUS_DEFAULT,
SWM_S_FOCUS_MODE,
SWM_S_FOCUS_CLOSE_WRAP,
SWM_S_FOCUS_DEFAULT,
SWM_S_FOCUS_MODE,
SWM_S_REGION_PADDING,
SWM_S_SPAWN_ORDER,
SWM_S_SPAWN_TERM,
SWM_S_REGION_PADDING,
SWM_S_SPAWN_ORDER,
SWM_S_SPAWN_TERM,
else
errx(1, "focus_mode");
break;
else
errx(1, "focus_mode");
break;
+ case SWM_S_ICONIC_ENABLED:
+ iconic_enabled = atoi(value);
+ break;
case SWM_S_REGION_PADDING:
region_padding = atoi(value);
if (region_padding < 0)
case SWM_S_REGION_PADDING:
region_padding = atoi(value);
if (region_padding < 0)
{ "focus_close_wrap", setconfvalue, SWM_S_FOCUS_CLOSE_WRAP },
{ "focus_default", setconfvalue, SWM_S_FOCUS_DEFAULT },
{ "focus_mode", setconfvalue, SWM_S_FOCUS_MODE },
{ "focus_close_wrap", setconfvalue, SWM_S_FOCUS_CLOSE_WRAP },
{ "focus_default", setconfvalue, SWM_S_FOCUS_DEFAULT },
{ "focus_mode", setconfvalue, SWM_S_FOCUS_MODE },
+ { "iconic_enabled", setconfvalue, SWM_S_ICONIC_ENABLED },
{ "keyboard_mapping", setkeymapping, 0 },
{ "layout", setlayout, 0 },
{ "modkey", setconfmodkey, 0 },
{ "keyboard_mapping", setkeymapping, 0 },
{ "layout", setlayout, 0 },
{ "modkey", setconfmodkey, 0 },
# stack_enabled = 1
# clock_enabled = 1
# clock_format = %a %b %d %R %Z %Y
# stack_enabled = 1
# clock_enabled = 1
# clock_format = %a %b %d %R %Z %Y
# window_class_enabled = 0
# window_instance_enabled = 0
# window_name_enabled = 0
# window_class_enabled = 0
# window_instance_enabled = 0
# window_name_enabled = 0