]> git.lizzy.rs Git - bspwm.git/commitdiff
Monocle: add cumulative padding settings
authorBastien Dejean <nihilhill@gmail.com>
Sat, 29 Sep 2018 16:57:05 +0000 (18:57 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 29 Sep 2018 16:57:05 +0000 (18:57 +0200)
Fixes #855.

contrib/bash_completion
contrib/fish_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.asciidoc
src/messages.c
src/settings.c
src/settings.h
src/tree.c

index ab57d02e68e5a06a1101a2a63a3a64ae5772cd5e..11e855a672dbf146396c5d3e7e4ab430f57d09da 100644 (file)
@@ -1,7 +1,7 @@
 _bspc() {
        local commands='node desktop monitor query rule wm subscribe config quit'
 
-       local settings='external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio automatic_scheme initial_polarity directional_focus_tightness borderless_monocle gapless_monocle single_monocle pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
+       local settings='external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme initial_polarity directional_focus_tightness borderless_monocle gapless_monocle single_monocle pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
 
        COMPREPLY=()
 
index a79c483713468db47adf458856ffda3941ca90d7..87c05eb995c337abb189fa0730e23cc1e776ae93 100644 (file)
@@ -11,4 +11,4 @@ function __fish_bspc_using_command
 end
 
 complete -f -c bspc -n '__fish_bspc_needs_command' -a 'node desktop monitor query rule wm subscribe config quit'
-complete -f -c bspc -n '__fish_bspc_using_command config' -a 'external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio automatic_scheme initial_polarity directional_focus_tightness borderless_monocle gapless_monocle single_monocle pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
+complete -f -c bspc -n '__fish_bspc_using_command config' -a 'external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme initial_polarity directional_focus_tightness borderless_monocle gapless_monocle single_monocle pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
index 3f94bfd650555c3cb0d57dfe51aad984a7dbd3a2..e16fbc8ee43d471810b50fbe3e7cddd4d8008c93 100644 (file)
@@ -316,7 +316,7 @@ _bspc() {
                (config)
                        local -a {look,behaviour,input}{_bool,}
                        look_bool=(borderless_monocle gapless_monocle)
-                       look=({normal,active,focused}_border_color {top,right,bottom,left}_padding presel_feedback_color border_width window_gap)
+                       look=({normal,active,focused}_border_color {top,right,bottom,left}_padding {top,right,bottom,left}_monocle_padding presel_feedback_color border_width window_gap)
                        behaviour_bool=(single_monocle ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors)
                        behaviour=(mapping_events_count ignore_ewmh_fullscreen external_rules_command split_ratio automatic_scheme initial_polarity directional_focus_tightness status_prefix)
                        input_bool=(swallow_first_click focus_follows_pointer pointer_follows_{focus,monitor})
index 0b59b74e3481e5390b663492e0cdcbf8698e61c5..7611c772b85f01b6062697c00d4cfa993c80b4ff 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 08/31/2018
+.\"      Date: 09/29/2018
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.5-14-g56ad57c
+.\"    Source: Bspwm 0.9.5-17-g8573b26
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "08/31/2018" "Bspwm 0\&.9\&.5\-14\-g56ad57c" "Bspwm Manual"
+.TH "BSPWM" "1" "09/29/2018" "Bspwm 0\&.9\&.5\-17\-g8573b26" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1188,9 +1188,9 @@ Remove gaps of tiled windows for the
 desktop layout\&.
 .RE
 .PP
-\fIpaddingless_monocle\fR
+\fItop_monocle_padding\fR, \fIright_monocle_padding\fR, \fIbottom_monocle_padding\fR, \fIleft_monocle_padding\fR
 .RS 4
-Remove padding space for the
+Padding space added at the sides of the screen for the
 \fBmonocle\fR
 desktop layout\&.
 .RE
index 29a455b56445d6941811303ad39d159c66a8640a..7b57f421abd211bf87dccfdb4464092d2a89287a 100644 (file)
@@ -692,8 +692,11 @@ Global Settings
 'gapless_monocle'::
        Remove gaps of tiled windows for the *monocle* desktop layout.
 
-'paddingless_monocle'::
-       Remove padding space for the *monocle* desktop layout.
+'top_monocle_padding'::
+'right_monocle_padding'::
+'bottom_monocle_padding'::
+'left_monocle_padding'::
+       Padding space added at the sides of the screen for the *monocle* desktop layout.
 
 'single_monocle'::
        Set the desktop layout to *monocle* if there's only one tiled window in the tree.
index e12b382285047d98ec56198ee3a5b4e013385da9..cd4b2f0248968dc510859174e72aa366da303e9a 100644 (file)
@@ -1515,6 +1515,22 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                }
                SET_DEF_MON_DESK(padding.left, lp)
 #undef SET_DEF_MON_DESK
+       } else if (streq("top_monocle_padding", name)) {
+               if (sscanf(value, "%i", &monocle_padding.top) != 1) {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+               }
+       } else if (streq("right_monocle_padding", name)) {
+               if (sscanf(value, "%i", &monocle_padding.right) != 1) {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+               }
+       } else if (streq("bottom_monocle_padding", name)) {
+               if (sscanf(value, "%i", &monocle_padding.bottom) != 1) {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+               }
+       } else if (streq("left_monocle_padding", name)) {
+               if (sscanf(value, "%i", &monocle_padding.left) != 1) {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+               }
 #define SET_STR(s) \
        } else if (streq(#s, name)) { \
                if (snprintf(s, sizeof(s), "%s", value) < 0) { \
@@ -1652,7 +1668,6 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                }
                SET_BOOL(borderless_monocle)
                SET_BOOL(gapless_monocle)
-               SET_BOOL(paddingless_monocle)
                SET_BOOL(single_monocle)
                SET_BOOL(swallow_first_click)
                SET_BOOL(pointer_follows_focus)
@@ -1733,6 +1748,14 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
        } else if (streq("left_padding", name)) {
                GET_DEF_MON_DESK(padding.left)
 #undef GET_DEF_MON_DESK
+       } else if (streq("top_monocle_padding", name)) {
+               fprintf(rsp, "%i", monocle_padding.top);
+       } else if (streq("right_monocle_padding", name)) {
+               fprintf(rsp, "%i", monocle_padding.right);
+       } else if (streq("bottom_monocle_padding", name)) {
+               fprintf(rsp, "%i", monocle_padding.bottom);
+       } else if (streq("left_monocle_padding", name)) {
+               fprintf(rsp, "%i", monocle_padding.left);
        } else if (streq("external_rules_command", name)) {
                fprintf(rsp, "%s", external_rules_command);
        } else if (streq("status_prefix", name)) {
@@ -1771,7 +1794,6 @@ void 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(swallow_first_click)
        GET_BOOL(focus_follows_pointer)
index 923d9ac703a946983795a1175b2d22dcaa77ccaf..3a5021cb8cca3007cc153d7cd45b394f51fa4003 100644 (file)
@@ -53,6 +53,7 @@ void load_settings(void)
        snprintf(presel_feedback_color, sizeof(presel_feedback_color), "%s", PRESEL_FEEDBACK_COLOR);
 
        padding = (padding_t) PADDING;
+       monocle_padding = (padding_t) MONOCLE_PADDING;
        window_gap = WINDOW_GAP;
        border_width = BORDER_WIDTH;
        split_ratio = SPLIT_RATIO;
@@ -69,7 +70,6 @@ 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;
index c4dcd27dc71da01a5e8ce6dad2d8f8a0a72dec15..4968a3cafa10a1c5fb6b44bf43fac4c55bbf0f18 100644 (file)
@@ -38,6 +38,7 @@
 #define PRESEL_FEEDBACK_COLOR         "#f4d775"
 
 #define PADDING              {0, 0, 0, 0}
+#define MONOCLE_PADDING      {0, 0, 0, 0}
 #define WINDOW_GAP           6
 #define BORDER_WIDTH         1
 #define SPLIT_RATIO          0.5
@@ -45,7 +46,6 @@
 
 #define BORDERLESS_MONOCLE          false
 #define GAPLESS_MONOCLE             false
-#define PADDINGLESS_MONOCLE         false
 #define SINGLE_MONOCLE              false
 
 #define FOCUS_FOLLOWS_POINTER       false
@@ -73,6 +73,7 @@ char focused_border_color[MAXLEN];
 char presel_feedback_color[MAXLEN];
 
 padding_t padding;
+padding_t monocle_padding;
 int window_gap;
 unsigned int border_width;
 double split_ratio;
@@ -87,7 +88,6 @@ int8_t mapping_events_count;
 
 bool borderless_monocle;
 bool gapless_monocle;
-bool paddingless_monocle;
 bool single_monocle;
 
 bool focus_follows_pointer;
index 9518c2eab37406ac68a41cd409a0a568c8af879a..2e61078d9343eca89d09b12f3aff9fbd1b042ab7 100644 (file)
@@ -54,11 +54,16 @@ void arrange(monitor_t *m, desktop_t *d)
 
        xcb_rectangle_t rect = m->rectangle;
 
-       if (!paddingless_monocle || l != LAYOUT_MONOCLE) {
-               rect.x += m->padding.left + d->padding.left;
-               rect.y += m->padding.top + d->padding.top;
-               rect.width -= m->padding.left + d->padding.left + d->padding.right + m->padding.right;
-               rect.height -= m->padding.top + d->padding.top + d->padding.bottom + m->padding.bottom;
+       rect.x += m->padding.left + d->padding.left;
+       rect.y += m->padding.top + d->padding.top;
+       rect.width -= m->padding.left + d->padding.left + d->padding.right + m->padding.right;
+       rect.height -= m->padding.top + d->padding.top + d->padding.bottom + m->padding.bottom;
+
+       if (l == LAYOUT_MONOCLE) {
+               rect.x += monocle_padding.left;
+               rect.y += monocle_padding.top;
+               rect.width -= monocle_padding.left + monocle_padding.right;
+               rect.height -= monocle_padding.top + monocle_padding.bottom;
        }
 
        if (!gapless_monocle || l != LAYOUT_MONOCLE) {