]> git.lizzy.rs Git - bspwm.git/commitdiff
Add global setting: *paddingless_monocle*
authorBastien Dejean <nihilhill@gmail.com>
Sun, 10 Jan 2016 17:29:51 +0000 (18:29 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Sun, 10 Jan 2016 17:29:51 +0000 (18:29 +0100)
Fixes #365.

doc/bspwm.1
doc/bspwm.1.asciidoc
messages.c
settings.c
settings.h
tree.c

index 510cab418fd94f8f24b93f2621c68fee1af5fe75..ae4f24b84b42ec2b3cfafc365a067321a671fb08 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 01/02/2016
+.\"      Date: 01/10/2016
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9-120-g5a9c710
+.\"    Source: Bspwm 0.9-125-g74166b0
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "01/02/2016" "Bspwm 0\&.9\-120\-g5a9c710" "Bspwm Manual"
+.TH "BSPWM" "1" "01/10/2016" "Bspwm 0\&.9\-125\-g74166b0" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1047,6 +1047,13 @@ Remove gaps of tiled windows for the
 desktop layout\&.
 .RE
 .PP
+\fIpaddingless_monocle\fR
+.RS 4
+Remove padding space for the
+\fBmonocle\fR
+desktop layout\&.
+.RE
+.PP
 \fIsingle_monocle\fR
 .RS 4
 Set the desktop layout to
index 13cc6c07f929c8f5fac015af7181f19a3eb514db..1fa0766eeb1673e5cfdaecc61113a13776be7ac8 100644 (file)
@@ -614,6 +614,9 @@ Global Settings
 'gapless_monocle'::
        Remove gaps of tiled windows for the *monocle* desktop layout.
 
+'paddingless_monocle'::
+       Remove padding space for the *monocle* desktop layout.
+
 'single_monocle'::
        Set the desktop layout to *monocle* if there's only one tiled window in the tree.
 
index de099ff34135c11397ab09dae39d9497a48d8246..1b6f2304ae5abdbf3782029f08df0fe02cdb0819 100644 (file)
@@ -1187,6 +1187,7 @@ int set_setting(coordinates_t loc, char *name, char *value)
                        return MSG_FAILURE;
                SET_BOOL(borderless_monocle)
                SET_BOOL(gapless_monocle)
+               SET_BOOL(paddingless_monocle)
                SET_BOOL(single_monocle)
                SET_BOOL(pointer_follows_focus)
                SET_BOOL(pointer_follows_monitor)
@@ -1271,6 +1272,7 @@ int get_setting(coordinates_t loc, char *name, FILE* rsp)
                fprintf(rsp, "%s", BOOL_STR(s));
        GET_BOOL(borderless_monocle)
        GET_BOOL(gapless_monocle)
+       GET_BOOL(paddingless_monocle)
        GET_BOOL(single_monocle)
        GET_BOOL(focus_follows_pointer)
        GET_BOOL(pointer_follows_focus)
index 71f4965547fa66322ee8dc7fa9801b9cf5707ff8..5ed2ed3e5783c66448e081b705c64979c9f0c3df 100644 (file)
@@ -57,6 +57,7 @@ void load_settings(void)
 
        borderless_monocle = BORDERLESS_MONOCLE;
        gapless_monocle = GAPLESS_MONOCLE;
+       paddingless_monocle = PADDINGLESS_MONOCLE;
        single_monocle = SINGLE_MONOCLE;
        focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
        pointer_follows_focus = POINTER_FOLLOWS_FOCUS;
index e50ec80fe49ac1dc22220108e8aab430914e54ce..30316e47a3bfa37d8391a7eb0139ab5997f0bce1 100644 (file)
@@ -46,6 +46,7 @@
 #define FOCUS_BY_DISTANCE           false
 #define BORDERLESS_MONOCLE          false
 #define GAPLESS_MONOCLE             false
+#define PADDINGLESS_MONOCLE         false
 #define SINGLE_MONOCLE              false
 #define FOCUS_FOLLOWS_POINTER       false
 #define POINTER_FOLLOWS_FOCUS       false
@@ -72,6 +73,7 @@ child_polarity_t initial_polarity;
 
 bool borderless_monocle;
 bool gapless_monocle;
+bool paddingless_monocle;
 bool single_monocle;
 bool focus_follows_pointer;
 bool pointer_follows_focus;
diff --git a/tree.c b/tree.c
index 74b641e77c5168c5619061e8a8e6503087b61a46..b08bc8e2e7bbec976910b7184124ff746a934e48 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -45,22 +45,31 @@ void arrange(monitor_t *m, desktop_t *d)
                return;
        }
 
-       layout_t set_layout = d->layout;
+       layout_t last_layout = d->layout;
 
        if (single_monocle && tiled_count(d->root) == 1) {
                d->layout = LAYOUT_MONOCLE;
        }
 
        xcb_rectangle_t rect = m->rectangle;
-       int wg = (gapless_monocle && d->layout == LAYOUT_MONOCLE ? 0 : d->window_gap);
-       rect.x += m->left_padding + d->left_padding + wg;
-       rect.y += m->top_padding + d->top_padding + wg;
-       rect.width -= m->left_padding + d->left_padding + d->right_padding + m->right_padding + wg;
-       rect.height -= m->top_padding + d->top_padding + d->bottom_padding + m->bottom_padding + wg;
+
+       if (!paddingless_monocle || d->layout != LAYOUT_MONOCLE) {
+               rect.x += m->left_padding + d->left_padding;
+               rect.y += m->top_padding + d->top_padding;
+               rect.width -= m->left_padding + d->left_padding + d->right_padding + m->right_padding;
+               rect.height -= m->top_padding + d->top_padding + d->bottom_padding + m->bottom_padding;
+       }
+
+       if (!gapless_monocle || d->layout != LAYOUT_MONOCLE) {
+               rect.x += d->window_gap;
+               rect.y += d->window_gap;
+               rect.width -= d->window_gap;
+               rect.height -= d->window_gap;
+       }
 
        apply_layout(m, d, d->root, rect, rect);
 
-       d->layout = set_layout;
+       d->layout = last_layout;
 }
 
 void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, xcb_rectangle_t root_rect)