]> git.lizzy.rs Git - bspwm.git/commitdiff
Pull and push edges via `window -e DIR ±PIXELS`
authorBastien Dejean <nihilhill@gmail.com>
Fri, 27 Dec 2013 13:46:35 +0000 (14:46 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Fri, 27 Dec 2013 13:46:35 +0000 (14:46 +0100)
12 files changed:
contrib/bash_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.txt
examples/sxhkdrc
messages.c
messages.h
settings.c
settings.h
tree.c
tree.h
types.h

index 9adbf4104fac6a02aa2d972ef467d3aa14c25195..bd170ca395fc39eba8578b444ced174d9a12f251 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 growth_factor borderless_monocle gapless_monocle focus_follows_pointer pointer_follows_monitor apply_floating_atom auto_alternate auto_cancel history_aware_focus ignore_ewmh_focus remove_disabled_monitor'
+    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 borderless_monocle gapless_monocle focus_follows_pointer pointer_follows_monitor apply_floating_atom auto_alternate auto_cancel history_aware_focus ignore_ewmh_focus remove_disabled_monitor'
 
     COMPREPLY=()
 
index 7e971f6a4417149865d4f203102e2399c4d6192b..9c98b91924d0c2fc3b2c56d7b1f5c94bcc4f3703 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' 'growth_factor' 'borderless_monocle' 'gapless_monocle' 'focus_follows_pointer' 'pointer_follows_monitor' 'apply_floating_atom' 'auto_alternate' 'auto_cancel' 'history_aware_focus' 'ignore_ewmh_focus' 'remove_disabled_monitor')
+    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' 'borderless_monocle' 'gapless_monocle' 'focus_follows_pointer' 'pointer_follows_monitor' 'apply_floating_atom' 'auto_alternate' 'auto_cancel' 'history_aware_focus' 'ignore_ewmh_focus' 'remove_disabled_monitor')
     if (( CURRENT == 2 )) ; then
         _values 'command' "$commands[@]"
     elif (( CURRENT == 3 )) ; then
index f5467c566f16e5c71d0f6594f94d2d8e205be6ac..24ed0e3a4ae09274850f9e7ed4dbea520ed3a74f 100644 (file)
@@ -529,9 +529,9 @@ Set the splitting ratio of the selected window (0 <
 < 1)\&.
 .RE
 .PP
-\fB\-e\fR, \fB\-\-edge\fR \fIDIR\fR \fIRATIO\fR|\(+-\fIPIXELS\fR|pull|push
+\fB\-e\fR, \fB\-\-edge\fR \fIDIR\fR \fIRATIO\fR|\(+-\fIPIXELS\fR
 .RS 4
-Set and change the splitting ratio of (or pull, or push) the edge located in the given direction in relation to the selected window\&.
+Set or change the splitting ratio of the edge located in the given direction in relation to the selected window\&.
 .RE
 .PP
 \fB\-R\fR, \fB\-\-rotate\fR \fIDIR\fR \fI90|270|180\fR
@@ -1010,11 +1010,6 @@ Color of the border of an urgent window\&.
 Default split ratio\&.
 .RE
 .PP
-\fIgrowth_factor\fR
-.RS 4
-Intensity of the growth involved in pulling or pushing an edge\&.
-.RE
-.PP
 \fIstatus_prefix\fR
 .RS 4
 Prefix prepended to each of the status lines\&.
index de513c559f4bf5140319e42cd9208058183a1393..7ffc5e4535c53ec23cc11ac3d18b13f0c2c14d0a 100644 (file)
@@ -343,8 +343,8 @@ Options
 *-r*, *--ratio* 'RATIO'::
     Set the splitting ratio of the selected window (0 < 'RATIO' < 1).
 
-*-e*, *--edge* 'DIR' 'RATIO'|±'PIXELS'|pull|push::
-    Set and change the splitting ratio of (or pull, or push) the edge located in the given direction in relation to the selected window.
+*-e*, *--edge* 'DIR' 'RATIO'|±'PIXELS'::
+    Set or change the splitting ratio of the edge located in the given direction in relation to the selected window.
 
 *-R*, *--rotate* 'DIR' '90|270|180'::
     Rotate the tree holding the edge located in the given direction in relation to the selected window.
@@ -622,9 +622,6 @@ Global Settings
 'split_ratio'::
     Default split ratio.
 
-'growth_factor'::
-    Intensity of the growth involved in pulling or pushing an edge.
-
 'status_prefix'::
     Prefix prepended to each of the status lines.
 
index 46901689b562af7f56b0bd98bd03c032242a8232..5497bf7ea2abfd3e5651682d916875454bbb0387 100644 (file)
@@ -53,10 +53,10 @@ super + ctrl + {_,shift + }space
     bspc {window -p cancel,desktop -c}
 
 super + alt + {h,j,k,l}
-    bspc window -e {left,down,up,right} push
+    bspc window -e {left -10,down +10,up -10,right +10}
 
 super + alt + shift + {h,j,k,l}
-    bspc window -e {right,up,down,left} pull
+    bspc window -e {right -10,up +10,down -10,left +10}
 
 super + ctrl + {1-9}
     bspc window -r 0.{1-9}
index 6bd52afd2cc1b6eee47d98ad285b48ed795c0aa5..1fba7bdda7da6f2dae18fcf43bd1fa50132e58e8 100644 (file)
@@ -260,29 +260,24 @@ bool cmd_window(char **args, int num)
             if (n == NULL)
                 return false;
             num--, args++;
-            fence_move_t fmo;
-            if (parse_fence_move(*args, &fmo)) {
-                move_fence(n, dir, fmo);
-            } else {
-                if ((*args)[0] == '+' || (*args)[0] == '-') {
-                    int pix;
-                    if (sscanf(*args, "%i", &pix) == 1) {
-                        int max = (n->split_type == TYPE_HORIZONTAL ? n->rectangle.height : n->rectangle.width);
-                        double rat = ((max * n->split_ratio) + pix) / max;
-                        if (rat > 0 && rat < 1)
-                            n->split_ratio = rat;
-                        else
-                            return false;
-                    } else {
-                        return false;
-                    }
-                } else {
-                    double rat;
-                    if (sscanf(*args, "%lf", &rat) == 1 && rat > 0 && rat < 1)
+            if ((*args)[0] == '+' || (*args)[0] == '-') {
+                int pix;
+                if (sscanf(*args, "%i", &pix) == 1) {
+                    int max = (n->split_type == TYPE_HORIZONTAL ? n->rectangle.height : n->rectangle.width);
+                    double rat = ((max * n->split_ratio) + pix) / max;
+                    if (rat > 0 && rat < 1)
                         n->split_ratio = rat;
                     else
                         return false;
+                } else {
+                    return false;
                 }
+            } else {
+                double rat;
+                if (sscanf(*args, "%lf", &rat) == 1 && rat > 0 && rat < 1)
+                    n->split_ratio = rat;
+                else
+                    return false;
             }
             dirty = true;
         } else if (streq("-r", *args) || streq("--ratio", *args)) {
@@ -907,13 +902,6 @@ bool set_setting(coordinates_t loc, char *name, char *value)
         else
             return false;
         return true;
-    } else if (streq("growth_factor", name)) {
-        double g;
-        if (sscanf(value, "%lf", &g) == 1 && g > 1)
-            growth_factor = g;
-        else
-            return false;
-        return true;
 #define SETCOLOR(s) \
     } else if (streq(#s, name)) { \
         snprintf(s, sizeof(s), "%s", value);
@@ -984,8 +972,6 @@ bool get_setting(coordinates_t loc, char *name, char* rsp)
 {
     if (streq("split_ratio", name))
         snprintf(rsp, BUFSIZ, "%lf", split_ratio);
-    else if (streq("growth_factor", name))
-        snprintf(rsp, BUFSIZ, "%lf", growth_factor);
     else if (streq("window_gap", name))
         if (loc.desktop == NULL)
             return false;
@@ -1136,18 +1122,6 @@ bool parse_flip(char *s, flip_t *f)
     return false;
 }
 
-bool parse_fence_move(char *s, fence_move_t *m)
-{
-    if (streq("push", s)) {
-        *m = MOVE_PUSH;
-        return true;
-    } else if (streq("pull", s)) {
-        *m = MOVE_PULL;
-        return true;
-    }
-    return false;
-}
-
 bool parse_pointer_action(char *s, pointer_action_t *a)
 {
     if (streq("move", s)) {
index 0dee48987ac7c9d9a15af1dc41ab158c1a622e01..46a27f46adef552df533bf6cbc4c4f34bebdfb48 100644 (file)
@@ -54,7 +54,6 @@ bool parse_cycle_direction(char *s, cycle_dir_t *d);
 bool parse_circulate_direction(char *s, circulate_dir_t *d);
 bool parse_history_direction(char *s, history_dir_t *d);
 bool parse_flip(char *s, flip_t *f);
-bool parse_fence_move(char *s, fence_move_t *m);
 bool parse_pointer_action(char *s, pointer_action_t *a);
 bool parse_degree(char *s, int *d);
 bool parse_window_id(char *s, long int *i);
index e2507056bd65a8e1c0cab0bfbeb780fb711f5163..997ef9302785bee6b57a29ccd5e62828ad6855c3 100644 (file)
@@ -58,7 +58,6 @@ void load_settings(void)
     snprintf(urgent_border_color, sizeof(urgent_border_color), "%s", URGENT_BORDER_COLOR);
 
     split_ratio = SPLIT_RATIO;
-    growth_factor = GROWTH_FACTOR;
 
     borderless_monocle = BORDERLESS_MONOCLE;
     gapless_monocle = GAPLESS_MONOCLE;
index 90e2e00dd1216495f8b84d50182401ee40fc0324..372347ea57ae6228e54da07e5415c1caf6f21913 100644 (file)
@@ -49,7 +49,6 @@
 #define URGENT_BORDER_COLOR           "#EFA29A"
 
 #define SPLIT_RATIO    0.5
-#define GROWTH_FACTOR  1.1
 
 #define HISTORY_AWARE_FOCUS      false
 #define BORDERLESS_MONOCLE       false
@@ -81,7 +80,6 @@ char normal_private_border_color[MAXLEN];
 char urgent_border_color[MAXLEN];
 
 double split_ratio;
-double growth_factor;
 
 bool borderless_monocle;
 bool gapless_monocle;
diff --git a/tree.c b/tree.c
index df78dd58c83133e44a3a8491ec57d67fab85b2bf..bcf5c743318d6d95bd2d840f53105ba7975e7ca7 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -408,12 +408,6 @@ bool is_second_child(node_t *n)
     return (n != NULL && n->parent != NULL && n->parent->second_child == n);
 }
 
-void change_split_ratio(node_t *n, value_change_t chg)
-{
-    n->split_ratio = pow(n->split_ratio,
-            (chg == CHANGE_INCREASE ? (1 / growth_factor) : growth_factor));
-}
-
 void reset_mode(coordinates_t *loc)
 {
     if (loc->node != NULL) {
@@ -727,18 +721,6 @@ node_t *find_biggest(monitor_t *m, desktop_t *d, node_t *n, client_select_t sel)
     return r;
 }
 
-void move_fence(node_t *n, direction_t dir, fence_move_t mov)
-{
-    if (n == NULL)
-        return;
-
-    if ((mov == MOVE_PUSH && (dir == DIR_RIGHT || dir == DIR_DOWN))
-            || (mov == MOVE_PULL && (dir == DIR_LEFT || dir == DIR_UP)))
-        change_split_ratio(n, CHANGE_INCREASE);
-    else
-        change_split_ratio(n, CHANGE_DECREASE);
-}
-
 void rotate_tree(node_t *n, int deg)
 {
     if (n == NULL || is_leaf(n) || deg == 0)
diff --git a/tree.h b/tree.h
index 962454e485db11f6860e9384a9d0e00f96732ae6..0cb8774569c8d70c502008f5b09ac3c28ae7edfd 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -38,7 +38,6 @@ bool is_tiled(client_t *c);
 bool is_floating(client_t *c);
 bool is_first_child(node_t *n);
 bool is_second_child(node_t *n);
-void change_split_ratio(node_t *n, value_change_t chg);
 void reset_mode(coordinates_t *loc);
 node_t *brother_tree(node_t *n);
 void closest_public(desktop_t *d, node_t *n, node_t **closest, node_t **public);
@@ -56,7 +55,6 @@ node_t *nearest_from_distance(monitor_t *m, desktop_t *d, node_t *n, direction_t
 void get_opposite(direction_t src, direction_t *dst);
 int tiled_area(node_t *n);
 node_t *find_biggest(monitor_t *m, desktop_t *d, node_t *n, client_select_t sel);
-void move_fence(node_t *n, direction_t dir, fence_move_t mov);
 void rotate_tree(node_t *n, int deg);
 void rotate_brother(node_t *n);
 void unrotate_tree(node_t *n, int rot);
diff --git a/types.h b/types.h
index 6316b6ba038d85aec3cd59d2fbcccff70f15da04..40add0fa4f7b19fe8b9795744e6dec42c24cea1f 100644 (file)
--- a/types.h
+++ b/types.h
@@ -44,16 +44,6 @@ typedef enum {
     MODE_MANUAL
 } split_mode_t;
 
-typedef enum {
-    MOVE_PULL,
-    MOVE_PUSH
-} fence_move_t;
-
-typedef enum {
-    CHANGE_INCREASE,
-    CHANGE_DECREASE
-} value_change_t;
-
 typedef enum {
     CLIENT_TYPE_ALL,
     CLIENT_TYPE_FLOATING,