]> git.lizzy.rs Git - bspwm.git/commitdiff
New setting: leaf_monocle
authorFredrik Bergroth <fbergroth@gmail.com>
Wed, 5 Aug 2015 21:20:07 +0000 (23:20 +0200)
committerFredrik Bergroth <fbergroth@gmail.com>
Wed, 5 Aug 2015 21:20:07 +0000 (23:20 +0200)
Use monocle layout if there is a single node.

contrib/bash_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.txt
messages.c
settings.c
settings.h
tree.c

index 7599d488b619fb68189436a79b28028f1f6b3098..027c5873a9c40291d5258f894f578091224d0d7d 100644 (file)
@@ -1,7 +1,7 @@
 _bspc() {
        local commands='window desktop monitor query pointer rule restore control config quit'
 
-       local settings='external_rules_command status_prefix focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_border_color focused_sticky_border_color normal_sticky_border_color focused_private_border_color active_private_border_color normal_private_border_color urgent_border_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle focus_follows_pointer pointer_follows_focus pointer_follows_monitor apply_floating_atom auto_alternate auto_cancel history_aware_focus focus_by_distance ignore_ewmh_focus center_pseudo_tiled remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
+       local settings='external_rules_command status_prefix focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_border_color focused_sticky_border_color normal_sticky_border_color focused_private_border_color active_private_border_color normal_private_border_color urgent_border_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle leaf_monocle focus_follows_pointer pointer_follows_focus pointer_follows_monitor apply_floating_atom auto_alternate auto_cancel history_aware_focus focus_by_distance ignore_ewmh_focus center_pseudo_tiled remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
 
        COMPREPLY=()
 
index 7e6bf741a6e7089b1e8eb82145401149d39f8628..04b886bb1116b1cc85b329074b73df56edf77145 100644 (file)
@@ -3,7 +3,7 @@
 _bspc() {
        local -a commands settings
        commands=('window' 'desktop' 'monitor' 'query' 'pointer' 'rule' 'restore' 'control' 'config' 'quit')
-       settings=('external_rules_command' 'status_prefix' 'focused_border_color' 'active_border_color' 'normal_border_color' 'presel_border_color' 'focused_locked_border_color' 'active_locked_border_color' 'normal_locked_border_color' 'focused_sticky_border_color' 'normal_sticky_border_color' 'focused_private_border_color' 'active_private_border_color' 'normal_private_border_color' 'urgent_border_color' 'border_width' 'window_gap' 'top_padding' 'right_padding' 'bottom_padding' 'left_padding' 'split_ratio' 'initial_polarity' 'borderless_monocle' 'gapless_monocle' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' 'apply_floating_atom' 'auto_alternate' 'auto_cancel' 'history_aware_focus' 'focus_by_distance' 'ignore_ewmh_focus' 'center_pseudo_tiled' 'remove_disabled_monitors' 'remove_unplugged_monitors' 'merge_overlapping_monitors')
+       settings=('external_rules_command' 'status_prefix' 'focused_border_color' 'active_border_color' 'normal_border_color' 'presel_border_color' 'focused_locked_border_color' 'active_locked_border_color' 'normal_locked_border_color' 'focused_sticky_border_color' 'normal_sticky_border_color' 'focused_private_border_color' 'active_private_border_color' 'normal_private_border_color' 'urgent_border_color' 'border_width' 'window_gap' 'top_padding' 'right_padding' 'bottom_padding' 'left_padding' 'split_ratio' 'initial_polarity' 'borderless_monocle' 'gapless_monocle' 'leaf_monocle' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' 'apply_floating_atom' 'auto_alternate' 'auto_cancel' 'history_aware_focus' 'focus_by_distance' 'ignore_ewmh_focus' 'center_pseudo_tiled' 'remove_disabled_monitors' 'remove_unplugged_monitors' 'merge_overlapping_monitors')
        if (( CURRENT == 2 )) ; then
                _values 'command' "$commands[@]"
        elif (( CURRENT == 3 )) ; then
index 64a0bb5ae57670c38b871562ce30ee15ca12ba5f..52034c2b6e0c361c249c40e53cefcf399d3393b0 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: 05/26/2015
+.\"      Date: 08/05/2015
 .\"    Manual: Bspwm Manual
 .\"    Source: Bspwm 0.9
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "05/26/2015" "Bspwm 0\&.9" "Bspwm Manual"
+.TH "BSPWM" "1" "08/05/2015" "Bspwm 0\&.9" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1093,6 +1093,11 @@ Remove borders for tiled windows in monocle mode\&.
 Remove gaps for tiled windows in monocle mode\&.
 .RE
 .PP
+\fIleaf_monocle\fR
+.RS 4
+Use monocle layout if there is a single node\&.
+.RE
+.PP
 \fIfocus_follows_pointer\fR
 .RS 4
 Focus the window under the pointer\&.
index 651486c25823799eaec325ff96e61a5a099cb487..ae073f9d82920a84fb0b3722baa81537d3f3b625 100644 (file)
@@ -670,6 +670,9 @@ Global Settings
 'gapless_monocle'::
        Remove gaps for tiled windows in monocle mode.
 
+'leaf_monocle'::
+       Use monocle layout if there is a single node.
+
 'focus_follows_pointer'::
        Focus the window under the pointer.
 
index 02d809b7899865bed4e6404eff653129a70f0398..66bcd872e43f892057327616b7dd1a038f690d57 100644 (file)
@@ -1044,6 +1044,7 @@ int set_setting(coordinates_t loc, char *name, char *value)
                        return MSG_FAILURE;
                SETBOOL(borderless_monocle)
                SETBOOL(gapless_monocle)
+               SETBOOL(leaf_monocle)
                SETBOOL(pointer_follows_focus)
                SETBOOL(pointer_follows_monitor)
                SETBOOL(apply_floating_atom)
@@ -1130,6 +1131,7 @@ int get_setting(coordinates_t loc, char *name, FILE* rsp)
                fprintf(rsp, "%s", BOOLSTR(s));
        GETBOOL(borderless_monocle)
        GETBOOL(gapless_monocle)
+       GETBOOL(leaf_monocle)
        GETBOOL(focus_follows_pointer)
        GETBOOL(pointer_follows_focus)
        GETBOOL(pointer_follows_monitor)
index e6ab7cca0de201501cfd69a71e31e2167325c8e2..c20f3d714606db424f493a7ea8f6a24a2cf527f2 100644 (file)
@@ -64,6 +64,7 @@ void load_settings(void)
 
        borderless_monocle = BORDERLESS_MONOCLE;
        gapless_monocle = GAPLESS_MONOCLE;
+       leaf_monocle = LEAF_MONOCLE;
        focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
        pointer_follows_focus = POINTER_FOLLOWS_FOCUS;
        pointer_follows_monitor = POINTER_FOLLOWS_MONITOR;
index b6d9ed4f80c6fb3dd9973803cf80fe2bc97ba32a..8608b768d9020ce610b6390e457a5cea95c673d4 100644 (file)
@@ -56,6 +56,7 @@
 #define FOCUS_BY_DISTANCE           false
 #define BORDERLESS_MONOCLE          false
 #define GAPLESS_MONOCLE             false
+#define LEAF_MONOCLE                false
 #define FOCUS_FOLLOWS_POINTER       false
 #define POINTER_FOLLOWS_FOCUS       false
 #define POINTER_FOLLOWS_MONITOR     false
@@ -93,6 +94,7 @@ child_polarity_t initial_polarity;
 
 bool borderless_monocle;
 bool gapless_monocle;
+bool leaf_monocle;
 bool focus_follows_pointer;
 bool pointer_follows_focus;
 bool pointer_follows_monitor;
diff --git a/tree.c b/tree.c
index c409a5b0c334a5965b45153d85022fa272b18359..1531930ccfccf28e1dd4a86325d250526d23f215 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -43,6 +43,10 @@ void arrange(monitor_t *m, desktop_t *d)
 
        PRINTF("arrange %s %s\n", m->name, d->name);
 
+       layout_t set_layout = d->layout;
+       if (leaf_monocle && is_leaf(d->root))
+               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;
@@ -50,6 +54,8 @@ void arrange(monitor_t *m, desktop_t *d)
        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;
        apply_layout(m, d, d->root, rect, rect);
+
+       d->layout = set_layout;
 }
 
 void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, xcb_rectangle_t root_rect)