Skip to content

Commit

Permalink
New setting: center_pseudo_tiled
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed Jan 15, 2015
1 parent 5cffc4c commit 1167e06
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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=()

Expand Down
2 changes: 1 addition & 1 deletion contrib/zsh_completion
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions doc/bspwm.1
Expand Up @@ -2,12 +2,12 @@
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" 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
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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\&.
Expand Down
7 changes: 5 additions & 2 deletions doc/bspwm.1.txt
Expand Up @@ -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
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -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.

Expand Down
2 changes: 2 additions & 0 deletions messages.c
Expand Up @@ -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)) { \
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions settings.c
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions settings.h
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 7 additions & 2 deletions tree.c
Expand Up @@ -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;
Expand Down

0 comments on commit 1167e06

Please sign in to comment.