]> git.lizzy.rs Git - bspwm.git/commitdiff
Add new setting: cancel_birth_rotation
authorBastien Dejean <nihilhill@gmail.com>
Sat, 25 Aug 2018 18:52:44 +0000 (20:52 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 25 Aug 2018 18:52:44 +0000 (20:52 +0200)
Fixes #832.

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
src/window.c

index 35c1f298352e3f25eb4f3f79288ae83096f26206..8659788ddb58eff06d09a954ad81778a7ec5d43e 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 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 split_ratio 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 cancel_birth_rotation remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
 
        COMPREPLY=()
 
index 940ad07260632db148f2fec5ccb0d24234aea8f5..ff99ff3d6c1e52ff352f9f7699560b61bad7394c 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 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 split_ratio 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 cancel_birth_rotation remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
index d66b9b2f87157b7b75ab3b8be354de48f97e6c3b..711833b754d3c05e96a7cfeb74c1d9bed7f0a0ea 100644 (file)
@@ -315,7 +315,7 @@ _bspc() {
                        local -a look behaviour input
                        # Boolean settings are identified by index!
                        look=(borderless_monocle gapless_monocle {normal,active,focused}_border_color {top,right,bottom,left}_padding presel_feedback_color border_width window_gap)
-                       behaviour=(single_monocle mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors status_prefix external_rules_command split_ratio initial_polarity directional_focus_tightness status_prefix)
+                       behaviour=(single_monocle mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints cancel_birth_rotation remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors status_prefix external_rules_command split_ratio initial_polarity directional_focus_tightness status_prefix)
                        input=({swallow_first_click,focus_follows_pointer,pointer_follows_{focus,monitor}} click_to_focus pointer_motion_interval pointer_modifier pointer_action{1,2,3} )
                        if [[ "$CURRENT" == (2|3) ]];then
                                _arguments \
index 404006bcfef4f4db473a508ee4aa7433e4ce0160..44d6a73877bd4b27fe0fc37a2f3b0a2d55c17d21 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: 06/25/2018
+.\"      Date: 08/25/2018
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.5-4-g3360957
+.\"    Source: Bspwm 0.9.5-9-gb5d1d85
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "06/25/2018" "Bspwm 0\&.9\&.5\-4\-g3360957" "Bspwm Manual"
+.TH "BSPWM" "1" "08/25/2018" "Bspwm 0\&.9\&.5\-9\-gb5d1d85" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1292,6 +1292,11 @@ Center pseudo tiled windows into their tiling rectangles\&. Defaults to
 Apply ICCCM window size hints\&.
 .RE
 .PP
+\fIcancel_birth_rotation\fR
+.RS 4
+When a node is unlinked from a tree, cancel the tree rotation that was applied during its insertion\&.
+.RE
+.PP
 \fIremove_disabled_monitors\fR
 .RS 4
 Consider disabled monitors as disconnected\&.
index 70f1919054113f94e895db60ce3618f2db814183..c5404a666d8d5a23341789cd60c29cbfc5534020 100644 (file)
@@ -736,6 +736,9 @@ Global Settings
 'honor_size_hints'::
        Apply ICCCM window size hints.
 
+'cancel_birth_rotation'::
+       When a node is unlinked from a tree, cancel the tree rotation that was applied during its insertion.
+
 'remove_disabled_monitors'::
        Consider disabled monitors as disconnected.
 
index 0ed08660a0849948bd4ec9e9de2cc24e13578316..004325577a86ae8c1a467c63429567c9ec3fbf5b 100644 (file)
@@ -1652,6 +1652,7 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                SET_BOOL(ignore_ewmh_focus)
                SET_BOOL(center_pseudo_tiled)
                SET_BOOL(honor_size_hints)
+               SET_BOOL(cancel_birth_rotation)
 #undef SET_BOOL
 #define SET_MON_BOOL(s) \
        } else if (streq(#s, name)) { \
@@ -1770,6 +1771,7 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
        GET_BOOL(ignore_ewmh_focus)
        GET_BOOL(center_pseudo_tiled)
        GET_BOOL(honor_size_hints)
+       GET_BOOL(cancel_birth_rotation)
        GET_BOOL(remove_disabled_monitors)
        GET_BOOL(remove_unplugged_monitors)
        GET_BOOL(merge_overlapping_monitors)
index f8390b8a2fdec1aad87db896dcf2c76a4b82ea6f..eeea41fc55171de1d171d9266d857a544c15a753 100644 (file)
@@ -81,6 +81,7 @@ void load_settings(void)
 
        center_pseudo_tiled = CENTER_PSEUDO_TILED;
        honor_size_hints = HONOR_SIZE_HINTS;
+       cancel_birth_rotation = CANCEL_BIRTH_ROTATION;
 
        remove_disabled_monitors = REMOVE_DISABLED_MONITORS;
        remove_unplugged_monitors = REMOVE_UNPLUGGED_MONITORS;
index 4c1564405c3156d02ab39d62e0ed99282a8bc30b..c29a24a5fc16d6b3d47494389b55a2ef4c52d8b1 100644 (file)
@@ -57,6 +57,7 @@
 
 #define CENTER_PSEUDO_TILED         true
 #define HONOR_SIZE_HINTS            false
+#define CANCEL_BIRTH_ROTATION       false
 #define MAPPING_EVENTS_COUNT        1
 
 #define REMOVE_DISABLED_MONITORS    false
@@ -98,6 +99,7 @@ state_transition_t ignore_ewmh_fullscreen;
 
 bool center_pseudo_tiled;
 bool honor_size_hints;
+bool cancel_birth_rotation;
 
 bool remove_disabled_monitors;
 bool remove_unplugged_monitors;
index 3f315140f3a11b029fb85c95fda7e67da04dd14f..0d645a162c6ea97e2aaaf0db056847c94eebe8d2 100644 (file)
@@ -376,8 +376,8 @@ node_t *insert_node(monitor_t *m, desktop_t *d, node_t *n, node_t *f)
                                        c->second_child = n;
                                        rot = 270;
                                }
-                               n->birth_rotation = rot;
                                if (!n->vacant) {
+                                       n->birth_rotation = rot;
                                        rotate_tree(p, rot);
                                }
                        }
@@ -1208,7 +1208,7 @@ void unlink_node(monitor_t *m, desktop_t *d, node_t *n)
                node_t *b = brother_tree(n);
                node_t *g = p->parent;
 
-               if (!n->vacant) {
+               if (!n->vacant && cancel_birth_rotation) {
                        unrotate_tree(b, n->birth_rotation);
                }
 
@@ -1625,10 +1625,7 @@ void set_vacant_local(monitor_t *m, desktop_t *d, node_t *n, bool value)
        n->vacant = value;
 
        if (value) {
-               unrotate_brother(n);
                cancel_presel(m, d, n);
-       } else {
-               rotate_brother(n);
        }
 }
 
index 56f41ee05054b587caf71aa8dd2b443515b0dc69..41bf15abd71122d115544cd77d9e2cec06f0ecfa 100644 (file)
@@ -158,9 +158,15 @@ bool manage_window(xcb_window_t win, rule_consequence_t *csq, int fd)
        snprintf(c->class_name, sizeof(c->class_name), "%s", csq->class_name);
        snprintf(c->instance_name, sizeof(c->instance_name), "%s", csq->instance_name);
 
+       if ((csq->state != NULL && (*(csq->state) == STATE_FLOATING || *(csq->state) == STATE_FULLSCREEN)) || csq->hidden) {
+               n->vacant = true;
+       }
+
        f = insert_node(m, d, n, f);
        clients_count++;
 
+       n->vacant = false;
+
        put_status(SBSC_MASK_NODE_ADD, "node_add 0x%08X 0x%08X 0x%08X 0x%08X\n", m->id, d->id, f!=NULL?f->id:0, win);
 
        if (f != NULL && f->client != NULL && csq->state != NULL && *(csq->state) == STATE_FLOATING) {