From 1167e068b28e1847717f23eac46e84ad84d58426 Mon Sep 17 00:00:00 2001 From: Bastien Dejean Date: Thu, 15 Jan 2015 14:18:25 +0100 Subject: [PATCH] New setting: center_pseudo_tiled --- contrib/bash_completion | 2 +- contrib/zsh_completion | 2 +- doc/bspwm.1 | 14 ++++++++++---- doc/bspwm.1.txt | 7 +++++-- messages.c | 2 ++ settings.c | 1 + settings.h | 2 ++ tree.c | 9 +++++++-- 8 files changed, 29 insertions(+), 10 deletions(-) diff --git a/contrib/bash_completion b/contrib/bash_completion index ba9c77ce..7599d488 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -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 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 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=() diff --git a/contrib/zsh_completion b/contrib/zsh_completion index a00e5014..7e6bf741 100644 --- a/contrib/zsh_completion +++ b/contrib/zsh_completion @@ -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' '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' '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 diff --git a/doc/bspwm.1 b/doc/bspwm.1 index fe41e21f..60955c2a 100644 --- a/doc/bspwm.1 +++ b/doc/bspwm.1 @@ -2,12 +2,12 @@ .\" Title: bspwm .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 -.\" Date: 01/06/2015 +.\" Date: 01/15/2015 .\" Manual: Bspwm Manual .\" Source: Bspwm 0.8.9 .\" Language: English .\" -.TH "BSPWM" "1" "01/06/2015" "Bspwm 0\&.8\&.9" "Bspwm Manual" +.TH "BSPWM" "1" "01/15/2015" "Bspwm 0\&.8\&.9" "Bspwm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -965,9 +965,9 @@ Unknown command\&. .RE .SH "SETTINGS" .sp -Colors are either X color names or \fI#RRGGBB\fR, booleans are \fItrue\fR or \fIfalse\fR\&. +Colors are either \fI#RRGGBB\fR or X color names, booleans are \fItrue\fR, \fIon\fR, \fIfalse\fR or \fIoff\fR\&. .sp -All the boolean settings are \fIfalse\fR by default\&. +All the boolean settings are \fIfalse\fR by default unless stated otherwise\&. .SS "Global Settings" .PP \fIfocused_border_color\fR @@ -1133,6 +1133,12 @@ atom of each window according to its floating state\&. Ignore EWMH focus requests coming from applications\&. .RE .PP +\fIcenter_pseudo_tiled\fR +.RS 4 +Center pseudo tiled windows into their tiling rectangles\&. Defaults to +\fItrue\fR\&. +.RE +.PP \fIremove_disabled_monitors\fR .RS 4 Consider disabled monitors as disconnected\&. diff --git a/doc/bspwm.1.txt b/doc/bspwm.1.txt index 89b4d10a..bed37682 100644 --- a/doc/bspwm.1.txt +++ b/doc/bspwm.1.txt @@ -594,9 +594,9 @@ If the server can't handle a message, *bspc* will return with one of the followi Settings -------- -Colors are either http://en.wikipedia.org/wiki/X11_color_names[X color names] or '#RRGGBB', booleans are 'true' or 'false'. +Colors are either '#RRGGBB' or http://en.wikipedia.org/wiki/X11_color_names[X color names], booleans are 'true', 'on', 'false' or 'off'. -All the boolean settings are 'false' by default. +All the boolean settings are 'false' by default unless stated otherwise. Global Settings ~~~~~~~~~~~~~~~ @@ -688,6 +688,9 @@ Global Settings 'ignore_ewmh_focus':: Ignore EWMH focus requests coming from applications. +'center_pseudo_tiled':: + Center pseudo tiled windows into their tiling rectangles. Defaults to 'true'. + 'remove_disabled_monitors':: Consider disabled monitors as disconnected. diff --git a/messages.c b/messages.c index c0f773a3..e9bf052d 100644 --- a/messages.c +++ b/messages.c @@ -1002,6 +1002,7 @@ int set_setting(coordinates_t loc, char *name, char *value) SETBOOL(history_aware_focus) SETBOOL(focus_by_distance) SETBOOL(ignore_ewmh_focus) + SETBOOL(center_pseudo_tiled) #undef SETBOOL #define SETMONBOOL(s) \ } else if (streq(#s, name)) { \ @@ -1088,6 +1089,7 @@ int get_setting(coordinates_t loc, char *name, FILE* rsp) GETBOOL(history_aware_focus) GETBOOL(focus_by_distance) GETBOOL(ignore_ewmh_focus) + GETBOOL(center_pseudo_tiled) GETBOOL(remove_disabled_monitors) GETBOOL(remove_unplugged_monitors) GETBOOL(merge_overlapping_monitors) diff --git a/settings.c b/settings.c index 1d731466..e6ab7cca 100644 --- a/settings.c +++ b/settings.c @@ -72,6 +72,7 @@ void load_settings(void) auto_cancel = AUTO_CANCEL; history_aware_focus = HISTORY_AWARE_FOCUS; ignore_ewmh_focus = IGNORE_EWMH_FOCUS; + center_pseudo_tiled = CENTER_PSEUDO_TILED; remove_disabled_monitors = REMOVE_DISABLED_MONITORS; remove_unplugged_monitors = REMOVE_UNPLUGGED_MONITORS; merge_overlapping_monitors = MERGE_OVERLAPPING_MONITORS; diff --git a/settings.h b/settings.h index 41f2cfc1..b6d9ed4f 100644 --- a/settings.h +++ b/settings.h @@ -63,6 +63,7 @@ #define AUTO_CANCEL false #define APPLY_FLOATING_ATOM false #define IGNORE_EWMH_FOCUS false +#define CENTER_PSEUDO_TILED true #define REMOVE_DISABLED_MONITORS false #define REMOVE_UNPLUGGED_MONITORS false #define MERGE_OVERLAPPING_MONITORS false @@ -101,6 +102,7 @@ bool auto_cancel; bool history_aware_focus; bool focus_by_distance; bool ignore_ewmh_focus; +bool center_pseudo_tiled; bool remove_disabled_monitors; bool remove_unplugged_monitors; bool merge_overlapping_monitors; diff --git a/tree.c b/tree.c index 2d5b4abb..08e23ca8 100644 --- a/tree.c +++ b/tree.c @@ -76,8 +76,13 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x if (n->client->pseudo_tiled) { /* pseudo-tiled clients */ r = n->client->floating_rectangle; - r.x = rect.x - bw + (rect.width - wg - r.width) / 2; - r.y = rect.y - bw + (rect.height - wg - r.height) / 2; + if (center_pseudo_tiled) { + r.x = rect.x - bw + (rect.width - wg - r.width) / 2; + r.y = rect.y - bw + (rect.height - wg - r.height) / 2; + } else { + r.x = rect.x; + r.y = rect.y; + } } else { /* tiled clients */ r = rect;