_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 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_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 borderless_monocle gapless_monocle focus_follows_pointer 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'
COMPREPLY=()
_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' '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_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' 'borderless_monocle' 'gapless_monocle' 'focus_follows_pointer' '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')
if (( CURRENT == 2 )) ; then
_values 'command' "$commands[@]"
elif (( CURRENT == 3 )) ; then
.\" Title: bspwm
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\" Date: 06/21/2014
+.\" Date: 07/18/2014
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.8.9
.\" Language: English
.\"
-.TH "BSPWM" "1" "06/21/2014" "Bspwm 0\&.8\&.9" "Bspwm Manual"
+.TH "BSPWM" "1" "07/18/2014" "Bspwm 0\&.8\&.9" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
Give priority to the focus history when focusing nodes\&.
.RE
.PP
+\fIfocus_by_distance\fR
+.RS 4
+Base focusing on distances between windows\&.
+.RE
+.PP
\fIborderless_monocle\fR
.RS 4
Remove borders for tiled windows in monocle mode\&.
'history_aware_focus'::
Give priority to the focus history when focusing nodes.
+'focus_by_distance'::
+ Base focusing on distances between windows.
+
'borderless_monocle'::
Remove borders for tiled windows in monocle mode.
bspc config split_ratio 0.52
bspc config borderless_monocle true
bspc config gapless_monocle true
+bspc config focus_by_distance true
bspc monitor -d I II III IV V VI VII VIII IX X
SETBOOL(auto_alternate)
SETBOOL(auto_cancel)
SETBOOL(history_aware_focus)
+ SETBOOL(focus_by_distance)
SETBOOL(ignore_ewmh_focus)
SETBOOL(remove_disabled_monitors)
SETBOOL(remove_unplugged_monitors)
GETBOOL(auto_alternate)
GETBOOL(auto_cancel)
GETBOOL(history_aware_focus)
+ GETBOOL(focus_by_distance)
GETBOOL(ignore_ewmh_focus)
GETBOOL(remove_disabled_monitors)
GETBOOL(remove_unplugged_monitors)
#define BORDER_WIDTH 1
#define HISTORY_AWARE_FOCUS false
+#define FOCUS_BY_DISTANCE false
#define BORDERLESS_MONOCLE false
#define GAPLESS_MONOCLE false
#define FOCUS_FOLLOWS_POINTER false
bool auto_alternate;
bool auto_cancel;
bool history_aware_focus;
+bool focus_by_distance;
bool ignore_ewmh_focus;
bool remove_disabled_monitors;
bool remove_unplugged_monitors;
node_t *nearest = NULL;
if (history_aware_focus)
nearest = nearest_from_history(m, d, n, dir, sel);
- if (nearest == NULL)
- nearest = nearest_from_distance(m, d, n, dir, sel);
+ if (nearest == NULL) {
+ if (focus_by_distance) {
+ nearest = nearest_from_distance(m, d, n, dir, sel);
+ } else {
+ nearest = nearest_from_tree(n, dir);
+ }
+ }
+ return nearest;
+}
+
+node_t *nearest_from_tree(node_t *n, direction_t dir)
+{
+ if (n == NULL)
+ return NULL;
+
+ node_t *fence = find_fence(n, dir);
+
+ if (fence == NULL)
+ return NULL;
+
+ node_t *nearest = NULL;
+
+ if (dir == DIR_UP || dir == DIR_LEFT)
+ nearest = second_extrema(fence->first_child);
+ else if (dir == DIR_DOWN || dir == DIR_RIGHT)
+ nearest = first_extrema(fence->second_child);
+
return nearest;
}
bool is_adjacent(node_t *a, node_t *b, direction_t dir);
node_t *find_fence(node_t *n, direction_t dir);
node_t *nearest_neighbor(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, client_select_t sel);
+node_t *nearest_from_tree(node_t *n, direction_t dir);
node_t *nearest_from_history(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, client_select_t sel);
node_t *nearest_from_distance(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, client_select_t sel);
void get_opposite(direction_t src, direction_t *dst);