]> git.lizzy.rs Git - bspwm.git/commitdiff
New setting: `growth_factor`
authorBastien Dejean <nihilhill@gmail.com>
Mon, 23 Sep 2013 08:53:21 +0000 (10:53 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Mon, 23 Sep 2013 08:53:21 +0000 (10:53 +0200)
contrib/bash_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.txt
messages.c
settings.c
settings.h
tree.c
tree.h

index 0a04d33d92a9f807393e5a196f32319cde829eaf..b5765a0cbdaac8602c36a5dd8a55dfab6f90a6f5 100644 (file)
@@ -1,7 +1,7 @@
 _bspc() {
     local commands='window desktop monitor query pointer rule restore control config quit'
 
-    local settings='focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_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'
+    local settings='focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_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'
 
     COMPREPLY=()
 
index f270186b102539924b0530d7fd0a3ae56d6a3e9f..acfc861e3fce6b04a6b9342b06f3e9238c340c6e 100644 (file)
@@ -3,7 +3,7 @@
 _bspc() {
     local -a commands settings
     commands=('window' 'desktop' 'monitor' 'query' 'pointer' 'rule' 'restore' 'control' 'config' 'quit')
-    settings=('focused_border_color' 'active_border_color' 'normal_border_color' 'presel_border_color' 'focused_locked_border_color' 'active_locked_border_color' 'normal_locked_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')
+    settings=('focused_border_color' 'active_border_color' 'normal_border_color' 'presel_border_color' 'focused_locked_border_color' 'active_locked_border_color' 'normal_locked_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')
     if (( CURRENT == 2 )) ; then
         _values 'command' "$commands[@]"
     elif (( CURRENT == 3 )) ; then
index 1658297be4297b69968823b20e8b38734a1e0408..b1e76ccaa0b478d24e93c36d452daad9afe036da 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: 09/20/2013
+.\"      Date: 09/23/2013
 .\"    Manual: Bspwm Manual
 .\"    Source: Bspwm 0.8
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "09/20/2013" "Bspwm 0\&.8" "Bspwm Manual"
+.TH "BSPWM" "1" "09/23/2013" "Bspwm 0\&.8" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -904,6 +904,11 @@ Window border width\&.
 Default split ratio\&.
 .RE
 .PP
+\fIgrowth_factor\fR
+.RS 4
+Intensity of the growth involved in pulling or pushing an edge\&.
+.RE
+.PP
 \fIhistory_aware_focus\fR
 .RS 4
 Give priority to the focus history when focusing nodes\&.
index 6657cbe53ba5237a342b28c9704907447e9c54ac..61ec8f045bb1b5f91786a862bc4398f4275a1df7 100644 (file)
@@ -555,6 +555,9 @@ Global Settings
 'split_ratio'::
     Default split ratio.
 
+'growth_factor'::
+    Intensity of the growth involved in pulling or pushing an edge.
+
 'history_aware_focus'::
     Give priority to the focus history when focusing nodes.
 
index 2bd4182289f9c83b9fe46f28610ad49ec7d11af6..b128b1752babd0764c956c4a4154f0bf4fcd5f70 100644 (file)
@@ -750,11 +750,19 @@ bool set_setting(coordinates_t loc, char *name, char *value)
     MONSET(left_padding)
 #undef MONSET
     } else if (streq("split_ratio", name)) {
-        double rat;
-        if (sscanf(value, "%lf", &rat) == 1 && rat > 0 && rat < 1)
-            split_ratio = rat;
+        double r;
+        if (sscanf(value, "%lf", &r) == 1 && r > 0 && r < 1)
+            split_ratio = r;
         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);
@@ -818,6 +826,8 @@ bool get_setting(coordinates_t loc, char *name, char* rsp)
         snprintf(rsp, BUFSIZ, "%u", border_width);
     else 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;
index 68bce7c3a28dd82f317cbfcac07924b6eec48605..edff6ed6589bdb4308c5b22ed5a233e42e1be4e2 100644 (file)
@@ -34,6 +34,7 @@ void load_settings(void)
 
     border_width = BORDER_WIDTH;
     split_ratio = SPLIT_RATIO;
+    growth_factor = GROWTH_FACTOR;
 
     borderless_monocle = BORDERLESS_MONOCLE;
     gapless_monocle = GAPLESS_MONOCLE;
index 7e1b18ddffc13076d3f1230c17b135453f5b7023..ed8c1b3a23ae6c4c3f551da008c2b7ec9c43de3e 100644 (file)
@@ -18,6 +18,7 @@
 
 #define BORDER_WIDTH   1
 #define SPLIT_RATIO    0.5
+#define GROWTH_FACTOR  1.1
 
 #define HISTORY_AWARE_FOCUS      false
 #define BORDERLESS_MONOCLE       false
@@ -39,6 +40,7 @@ char urgent_border_color[MAXLEN];
 
 unsigned int border_width;
 double split_ratio;
+double growth_factor;
 
 bool borderless_monocle;
 bool gapless_monocle;
diff --git a/tree.c b/tree.c
index 8b51242b74166b73984c52e7b7f336016d0e7f4c..79dc1355b8f5d25e5c150b733c8e81b3fbc5403d 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -330,7 +330,7 @@ bool is_second_child(node_t *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));
+            (chg == CHANGE_INCREASE ? (1 / growth_factor) : growth_factor));
 }
 
 void reset_mode(coordinates_t *loc)
diff --git a/tree.h b/tree.h
index 42e471f05b694c5ec47f752ff99002d556b5e577..e3389346f6197d859500f193d2e9fee9fb9d541e 100644 (file)
--- a/tree.h
+++ b/tree.h
@@ -1,8 +1,6 @@
 #ifndef _TREE_H
 #define _TREE_H
 
-#define GROWTH_FACTOR  1.1
-
 node_t *make_node(void);
 client_t *make_client(xcb_window_t);
 void arrange(monitor_t *, desktop_t *);