]> git.lizzy.rs Git - bspwm.git/commitdiff
New setting: 'gapless_monocle'
authorBastien Dejean <nihilhill@gmail.com>
Sun, 4 Nov 2012 13:10:08 +0000 (14:10 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 4 Nov 2012 13:10:08 +0000 (14:10 +0100)
README.md
bspwm.1
messages.c
settings.c
settings.h
tree.c

index 0f15bee7a44e5dd0c3f24bf15d4e40fce4590067..13527a6477a209c11ab991e0df5f467ab2b2b8c6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -260,6 +260,9 @@ Colors are either [X color names](http://en.wikipedia.org/wiki/X11_color_names)
     borderless_monocle
         Whether to remove borders for tiled windows in monocle mode.
 
+    gapless_monocle
+        Whether to remove gaps for tiled windows in monocle mode.
+
     focus_follows_mouse
         Wether to focus the window under the mouse pointer.
 
diff --git a/bspwm.1 b/bspwm.1
index f2823eafc42e3c2152d4b4ddf8c212931e943001..39a74110395758b2cc518c381d0e5d65a2e4605c 100644 (file)
--- a/bspwm.1
+++ b/bspwm.1
@@ -296,6 +296,9 @@ The modifier mask used for mouse bindings (possible values:
 .I borderless_monocle
 Whether to remove borders for tiled windows in monocle mode.
 .TP
+.I gapless_monocle
+Whether to remove gaps for tiled windows in monocle mode.
+.TP
 .I focus_follows_mouse
 Wether to focus the window under the mouse pointer.
 .SH MOUSE BINDINGS
index 59cd2a478f9011660b2c090c919168bbfb2dd353..b13fe1d0175a78e98b574fb577256e17378ba3be 100644 (file)
@@ -367,6 +367,10 @@ void set_setting(char *name, char *value, char *rsp)
         bool b;
         if (parse_bool(value, &b))
             borderless_monocle = b;
+    } else if (strcmp(name, "gapless_monocle") == 0) {
+        bool b;
+        if (parse_bool(value, &b))
+            gapless_monocle = b;
     } else if (strcmp(name, "focus_follows_mouse") == 0) {
         bool b;
         if (parse_bool(value, &b))
@@ -436,6 +440,8 @@ void get_setting(char *name, char* rsp)
         snprintf(rsp, BUFSIZ, "%s (%06X)", urgent_border_color, urgent_border_color_pxl);
     else if (strcmp(name, "borderless_monocle") == 0)
         snprintf(rsp, BUFSIZ, "%s", BOOLSTR(borderless_monocle));
+    else if (strcmp(name, "gapless_monocle") == 0)
+        snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
     else if (strcmp(name, "focus_follows_mouse") == 0)
         snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_mouse));
     else if (strcmp(name, "wm_name") == 0)
index f36c511721a66a83e8d15aa492ccfd5291a12b8a..2a3e4e5fe0a56aa99427d541a82f8c78dbae84f5 100644 (file)
@@ -67,5 +67,6 @@ void load_settings(void)
     bottom_padding = BOTTOM_PADDING;
 
     borderless_monocle = BORDERLESS_MONOCLE;
+    gapless_monocle = GAPLESS_MONOCLE;
     focus_follows_mouse = FOCUS_FOLLOWS_MOUSE;
 }
index 1e8ee67de52d7cd94b22a9222664df94d90673aa..99cda23ed4c0695d6c18910e2e5e0f4c1b997e76 100644 (file)
@@ -30,6 +30,7 @@
 #define RIGHT_PADDING       0
 
 #define BORDERLESS_MONOCLE   false
+#define GAPLESS_MONOCLE      false
 #define FOCUS_FOLLOWS_MOUSE  false
 
 char focused_border_color[MAXLEN];
@@ -66,6 +67,7 @@ int left_padding;
 int right_padding;
 
 bool borderless_monocle;
+bool gapless_monocle;
 bool focus_follows_mouse;
 
 char wm_name[MAXLEN];
diff --git a/tree.c b/tree.c
index ab29dd768c21972cda14bdf90c1b4440f96a4714..0b7bba54b0ebe6bb9c478de21a7d9401e178c121 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -266,10 +266,11 @@ void arrange(monitor_t *m, desktop_t *d)
     PRINTF("arrange %s%s%s\n", (num_monitors > 1 ? m->name : ""), (num_monitors > 1 ? " " : ""), d->name);
 
     xcb_rectangle_t rect = m->rectangle;
-    rect.x += left_padding + window_gap;
-    rect.y += top_padding + window_gap;
-    rect.width -= left_padding + right_padding + window_gap;
-    rect.height -= top_padding + bottom_padding + window_gap;
+    int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : window_gap);
+    rect.x += left_padding + wg;
+    rect.y += top_padding + wg;
+    rect.width -= left_padding + right_padding + wg;
+    rect.height -= top_padding + bottom_padding + wg;
     if (focus_follows_mouse)
         get_pointer_position(&pointer_position);
     apply_layout(m, d, d->root, rect, rect);
@@ -303,7 +304,8 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x
                 r = rect;
             else if (d->layout == LAYOUT_MONOCLE)
                 r = root_rect;
-            int bleed = window_gap + 2 * n->client->border_width;
+            int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : window_gap);
+            int bleed = wg + 2 * n->client->border_width;
             r.width = (bleed < r.width ? r.width - bleed : 1);
             r.height = (bleed < r.height ? r.height - bleed : 1);
             n->client->tiled_rectangle = r;