]> code.delx.au - spectrwm/commitdiff
Add new option: urgent_collapse
authorReginald Kennedy <rk@rejii.com>
Thu, 14 Aug 2014 20:08:44 +0000 (04:08 +0800)
committerReginald Kennedy <rk@rejii.com>
Thu, 14 Aug 2014 20:08:48 +0000 (04:08 +0800)
Enables hiding of placeholders in the urgency hint indicator for
workspaces that do not have any urgent windows.

Closes #60

spectrwm.1
spectrwm.c

index d01e049e7796a5416b20bbe73e62001a411595b5..1a7ac7458d4a542ce9b7434dddd1856942268d60 100644 (file)
@@ -400,6 +400,9 @@ binary without the setgid bit set.
 Pixel width of empty space between tiled windows.  Negative values cause overlap.
 Set this to the opposite of border_width to collapse the border between tiles.
 Disable by setting to 0.
 Pixel width of empty space between tiled windows.  Negative values cause overlap.
 Set this to the opposite of border_width to collapse the border between tiles.
 Disable by setting to 0.
+.It Ic urgent_collapse
+Enables hiding of placeholders in the urgency hint indicator for workspaces that
+do not have any urgent windows.  Enable by setting to 1.
 .It Ic urgent_enabled
 Enable or disable the urgency hint indicator in the status bar.
 Note that many terminal emulators require an explicit setting for the bell
 .It Ic urgent_enabled
 Enable or disable the urgency hint indicator in the status bar.
 Note that many terminal emulators require an explicit setting for the bell
index 478a6f2d9309b89a35ec49d11921c25ba9b8519d..0ca00bb425d08a93df4cf17dac71d2079dc53856 100644 (file)
@@ -402,6 +402,7 @@ bool                 stack_enabled = true;
 bool            clock_enabled = true;
 bool            iconic_enabled = false;
 bool            urgent_enabled = false;
 bool            clock_enabled = true;
 bool            iconic_enabled = false;
 bool            urgent_enabled = false;
+bool            urgent_collapse = false;
 char           *clock_format = NULL;
 bool            window_class_enabled = false;
 bool            window_instance_enabled = false;
 char           *clock_format = NULL;
 bool            window_class_enabled = false;
 bool            window_instance_enabled = false;
@@ -2193,11 +2194,12 @@ bar_urgent(char *s, size_t sz)
                        }
 
        for (i = 0; i < workspace_limit; i++) {
                        }
 
        for (i = 0; i < workspace_limit; i++) {
-               if (urgent[i])
+               if (urgent[i]) {
                        snprintf(b, sizeof b, "%d ", i + 1);
                        snprintf(b, sizeof b, "%d ", i + 1);
-               else
-                       snprintf(b, sizeof b, "- ");
-               strlcat(s, b, sz);
+                       strlcat(s, b, sz);
+               } else if (!urgent_collapse) {
+                       strlcat(s, "- ", sz);
+               }
        }
 }
 
        }
 }
 
@@ -7906,6 +7908,7 @@ enum {
        SWM_S_STACK_ENABLED,
        SWM_S_TERM_WIDTH,
        SWM_S_TILE_GAP,
        SWM_S_STACK_ENABLED,
        SWM_S_TERM_WIDTH,
        SWM_S_TILE_GAP,
+       SWM_S_URGENT_COLLAPSE,
        SWM_S_URGENT_ENABLED,
        SWM_S_VERBOSE_LAYOUT,
        SWM_S_WARP_POINTER,
        SWM_S_URGENT_ENABLED,
        SWM_S_VERBOSE_LAYOUT,
        SWM_S_WARP_POINTER,
@@ -8108,6 +8111,9 @@ setconfvalue(const char *selector, const char *value, int flags)
        case SWM_S_TILE_GAP:
                tile_gap = atoi(value);
                break;
        case SWM_S_TILE_GAP:
                tile_gap = atoi(value);
                break;
+       case SWM_S_URGENT_COLLAPSE:
+               urgent_collapse = (atoi(value) != 0);
+               break;
        case SWM_S_URGENT_ENABLED:
                urgent_enabled = (atoi(value) != 0);
                break;
        case SWM_S_URGENT_ENABLED:
                urgent_enabled = (atoi(value) != 0);
                break;
@@ -8454,6 +8460,7 @@ struct config_option configopt[] = {
        { "tile_gap",                   setconfvalue,   SWM_S_TILE_GAP },
        { "title_class_enabled",        setconfvalue,   SWM_S_WINDOW_CLASS_ENABLED }, /* For backwards compat. */
        { "title_name_enabled",         setconfvalue,   SWM_S_WINDOW_INSTANCE_ENABLED }, /* For backwards compat. */
        { "tile_gap",                   setconfvalue,   SWM_S_TILE_GAP },
        { "title_class_enabled",        setconfvalue,   SWM_S_WINDOW_CLASS_ENABLED }, /* For backwards compat. */
        { "title_name_enabled",         setconfvalue,   SWM_S_WINDOW_INSTANCE_ENABLED }, /* For backwards compat. */
+       { "urgent_collapse",            setconfvalue,   SWM_S_URGENT_COLLAPSE },
        { "urgent_enabled",             setconfvalue,   SWM_S_URGENT_ENABLED },
        { "verbose_layout",             setconfvalue,   SWM_S_VERBOSE_LAYOUT },
        { "warp_pointer",               setconfvalue,   SWM_S_WARP_POINTER },
        { "urgent_enabled",             setconfvalue,   SWM_S_URGENT_ENABLED },
        { "verbose_layout",             setconfvalue,   SWM_S_VERBOSE_LAYOUT },
        { "warp_pointer",               setconfvalue,   SWM_S_WARP_POINTER },