]> code.delx.au - spectrwm/commitdiff
Character sequence for the floating indicator.
authorTiago Cunha <tcunha@gmx.com>
Thu, 31 May 2012 21:28:26 +0000 (22:28 +0100)
committerTiago Cunha <tcunha@gmx.com>
Tue, 5 Jun 2012 21:32:02 +0000 (22:32 +0100)
spectrwm.1
spectrwm.c

index a925b722a0434f84b068344e021081b3ec4f00c4..d14c707e10eb76a53c0a73771d3a835bc94ef07d 100644 (file)
@@ -118,6 +118,7 @@ It may contain the following character sequences:
 .It Li "+A" Ta "Output of the external script"
 .It Li "+C" Ta "Window class"
 .It Li "+D" Ta "Workspace name"
+.It Li "+F" Ta "Floating indicator"
 .It Li "+I" Ta "Workspace index"
 .It Li "+N" Ta "Screen number"
 .It Li "+S" Ta "Stacking algorithm"
index 2ecc60f77162f6fd97c608cac2a15fe4992bff2b..436e84d70158450a5e96403fa38860b44cd75e77 100644 (file)
@@ -1368,6 +1368,15 @@ bar_title_name(char *s, size_t sz, struct swm_region *r)
                strlcat(s, r->ws->focus->ch.res_name, sz);
 }
 
+void
+bar_window_float(char *s, size_t sz, struct swm_region *r)
+{
+       if (r == NULL || r ->ws == NULL || r->ws->focus == NULL)
+               return;
+       if (r->ws->focus->floating)
+               strlcat(s, "(f)", sz);
+}
+
 void
 bar_window_name(char *s, size_t sz, struct swm_region *r)
 {
@@ -1378,10 +1387,7 @@ bar_window_name(char *s, size_t sz, struct swm_region *r)
        if ((title = get_win_name(r->ws->focus->id)) == NULL)
                return;
 
-       if (r->ws->focus->floating)
-               strlcat(s, "(f) ", sz);
        strlcat(s, (char *)title, sz);
-
        XFree(title);
 }
 
@@ -1465,17 +1471,20 @@ bar_fmt(const char *fmtexp, char *fmtnew, struct swm_region *r, size_t sz)
                        strlcat(fmtnew, "    ", sz);
        }
 
-       if (title_name_enabled) {
-               /* add a colon if showing the class and something is focused */
-               if (title_class_enabled && r != NULL && r->ws != NULL &&
-                   r->ws->focus != NULL)
-                       strlcat(fmtnew, ":", sz);
-               strlcat(fmtnew, "+T    ", sz);
+       /* checks needed by the colon and floating strlcat(3) calls below */
+       if (r != NULL && r->ws != NULL && r->ws->focus != NULL) {
+               if (title_name_enabled) {
+                       if (title_class_enabled)
+                               strlcat(fmtnew, ":", sz);
+                       strlcat(fmtnew, "+T    ", sz);
+               }
+               if (window_name_enabled) {
+                       if (r->ws->focus->floating)
+                               strlcat(fmtnew, "+F ", sz);
+                       strlcat(fmtnew, "+64W ", sz);
+               }
        }
 
-       if (window_name_enabled)
-               strlcat(fmtnew, "+64W ", sz);
-
        /* finally add the action script output and the version */
        strlcat(fmtnew, "    +A    +V", sz);
 }
@@ -1524,6 +1533,9 @@ bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep,
        case 'D':
                bar_workspace_name(tmp, sizeof tmp, r);
                break;
+       case 'F':
+               bar_window_float(tmp, sizeof tmp, r);
+               break;
        case 'I':
                snprintf(tmp, sizeof tmp, "%d", r->ws->idx + 1);
                break;