]> code.delx.au - spectrwm/commitdiff
Add new bar_enabled_ws[x] config option.
authorReginald Kennedy <rk@rejii.com>
Thu, 6 Sep 2012 12:16:14 +0000 (20:16 +0800)
committerReginald Kennedy <rk@rejii.com>
Thu, 6 Sep 2012 12:20:17 +0000 (20:20 +0800)
It is now possible to set the default state for bar_toggle_ws.

spectrwm.1
spectrwm.c

index 3ef5233ab91d213ceadaed15f16299c0a7c5e998..59a5acb936140aa1e274a3c3c7c5fec98090a836 100644 (file)
@@ -106,7 +106,15 @@ Color of the status bar window in screen
 Update frequency, in seconds, of external script that populates the status
 bar.
 .It Ic bar_enabled
-Enable or disable status bar.
+Set default
+.Ar bar_toggle
+state; default is 1.
+.It Ic bar_enabled_ws Ns Bq Ar x
+Set default
+.Ar bar_toggle_ws
+state on workspace
+.Ar x ;
+default is 1.
 .It Ic bar_font
 Font used in the status bar. Either Xft or X Logical Font Description (XLFD)
 may be used to specify fonts. Fallback fonts may be specified by separating
index 1f092e9d9dd383cb043f8ba98325daa788927044..639969f4f9517e82b61dece1f7b1a9bf5fa47bfd 100644 (file)
@@ -6435,6 +6435,7 @@ enum {
        SWM_S_BAR_BORDER_WIDTH,
        SWM_S_BAR_DELAY,
        SWM_S_BAR_ENABLED,
+       SWM_S_BAR_ENABLED_WS,
        SWM_S_BAR_FONT,
        SWM_S_BAR_FORMAT,
        SWM_S_BAR_JUSTIFY,
@@ -6466,8 +6467,9 @@ enum {
 int
 setconfvalue(char *selector, char *value, int flags)
 {
-       int     i;
-       char    *b;
+       struct workspace        *ws;
+       int                     i, ws_id, num_screens;
+       char                    *b;
 
        /* suppress unused warning since var is needed */
        (void)selector;
@@ -6492,6 +6494,18 @@ setconfvalue(char *selector, char *value, int flags)
        case SWM_S_BAR_ENABLED:
                bar_enabled = atoi(value);
                break;
+       case SWM_S_BAR_ENABLED_WS:
+               ws_id = atoi(selector) - 1;
+               if (ws_id < 0 || ws_id >= workspace_limit)
+                       errx(1, "setconfvalue: bar_enabled_ws: invalid "
+                           "workspace %d.", ws_id + 1);
+
+               num_screens = xcb_setup_roots_length(xcb_get_setup(conn));
+               for (i = 0; i < num_screens; i++) {
+                       ws = (struct workspace *)&screens[i].ws;
+                       ws[ws_id].bar_enabled = atoi(value);
+               }
+               break;
        case SWM_S_BAR_FONT:
                b = bar_fonts;
                if (asprintf(&bar_fonts, "%s,%s", value, bar_fonts) == -1)
@@ -6857,6 +6871,7 @@ struct config_option {
 };
 struct config_option configopt[] = {
        { "bar_enabled",                setconfvalue,   SWM_S_BAR_ENABLED },
+       { "bar_enabled_ws",             setconfvalue,   SWM_S_BAR_ENABLED_WS },
        { "bar_at_bottom",              setconfvalue,   SWM_S_BAR_AT_BOTTOM },
        { "bar_border",                 setconfcolor,   SWM_S_COLOR_BAR_BORDER },
        { "bar_border_width",           setconfvalue,   SWM_S_BAR_BORDER_WIDTH },