Skip to content

Commit

Permalink
Remove setting: focus_by_distance
Browse files Browse the repository at this point in the history
Unfortunately nearest_from_tree is rather useless because it can't skip
vacant or receptacle nodes.

Therefore, *focus_by_distance* is now the default.
  • Loading branch information
baskerville committed Apr 21, 2016
1 parent 09e3d72 commit 57b12d8
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 56 deletions.
2 changes: 1 addition & 1 deletion contrib/bash_completion
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
_bspc() {
local commands='node desktop monitor query rule restore wm subscribe config quit'

local settings='external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor history_aware_focus focus_by_distance ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
local settings='external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor history_aware_focus ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'

COMPREPLY=()

Expand Down
2 changes: 1 addition & 1 deletion contrib/zsh_completion
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_bspc() {
local -a commands settings
commands=('node' 'desktop' 'monitor' 'query' 'rule' 'restore' 'wm' 'subscribe' 'config' 'quit')
settings=('external_rules_command' 'status_prefix' 'normal_border_color' 'active_border_color' 'focused_border_color' 'presel_feedback_color' 'border_width' 'window_gap' 'top_padding' 'right_padding' 'bottom_padding' 'left_padding' 'split_ratio' 'initial_polarity' 'borderless_monocle' 'gapless_monocle' 'single_monocle' 'pointer_modifier' 'pointer_action1' 'pointer_action2' 'pointer_action3' 'click_to_focus' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' 'history_aware_focus' 'focus_by_distance' 'ignore_ewmh_focus' 'center_pseudo_tiled' 'honor_size_hints' 'remove_disabled_monitors' 'remove_unplugged_monitors' 'merge_overlapping_monitors')
settings=('external_rules_command' 'status_prefix' 'normal_border_color' 'active_border_color' 'focused_border_color' 'presel_feedback_color' 'border_width' 'window_gap' 'top_padding' 'right_padding' 'bottom_padding' 'left_padding' 'split_ratio' 'initial_polarity' 'borderless_monocle' 'gapless_monocle' 'single_monocle' 'pointer_modifier' 'pointer_action1' 'pointer_action2' 'pointer_action3' 'click_to_focus' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' 'history_aware_focus' 'ignore_ewmh_focus' 'center_pseudo_tiled' 'honor_size_hints' 'remove_disabled_monitors' 'remove_unplugged_monitors' 'merge_overlapping_monitors')
if (( CURRENT == 2 )) ; then
_values 'command' "$commands[@]"
elif (( CURRENT == 3 )) ; then
Expand Down
11 changes: 3 additions & 8 deletions doc/bspwm.1
Original file line number Diff line number Diff line change
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: 04/19/2016
.\" Date: 04/21/2016
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.9.1-39-ge70f826
.\" Source: Bspwm 0.9.1-45-g09e3d72
.\" Language: English
.\"
.TH "BSPWM" "1" "04/19/2016" "Bspwm 0\&.9\&.1\-39\-ge70f826" "Bspwm Manual"
.TH "BSPWM" "1" "04/21/2016" "Bspwm 0\&.9\&.1\-45\-g09e3d72" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -1022,11 +1022,6 @@ On which child should a new window be attached when adding a window on a single
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 of tiled windows for the
Expand Down
3 changes: 0 additions & 3 deletions doc/bspwm.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,6 @@ Global Settings
'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 of tiled windows for the *monocle* desktop layout.

Expand Down
1 change: 0 additions & 1 deletion examples/bspwmrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ bspc config window_gap 12
bspc config split_ratio 0.52
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config focus_by_distance true
bspc config history_aware_focus true

bspc rule -a Gimp desktop='^8' state=floating follow=on
Expand Down
2 changes: 0 additions & 2 deletions messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,6 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
SET_BOOL(pointer_follows_focus)
SET_BOOL(pointer_follows_monitor)
SET_BOOL(history_aware_focus)
SET_BOOL(focus_by_distance)
SET_BOOL(ignore_ewmh_focus)
SET_BOOL(center_pseudo_tiled)
SET_BOOL(honor_size_hints)
Expand Down Expand Up @@ -1557,7 +1556,6 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
GET_BOOL(pointer_follows_focus)
GET_BOOL(pointer_follows_monitor)
GET_BOOL(history_aware_focus)
GET_BOOL(focus_by_distance)
GET_BOOL(ignore_ewmh_focus)
GET_BOOL(center_pseudo_tiled)
GET_BOOL(honor_size_hints)
Expand Down
3 changes: 0 additions & 3 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#define EXTERNAL_RULES_COMMAND ""
#define STATUS_PREFIX "W"


#define NORMAL_BORDER_COLOR "#30302f"
#define ACTIVE_BORDER_COLOR "#474645"
#define FOCUSED_BORDER_COLOR "#817f7f"
Expand All @@ -46,7 +45,6 @@
#define SPLIT_RATIO 0.5

#define HISTORY_AWARE_FOCUS false
#define FOCUS_BY_DISTANCE false
#define BORDERLESS_MONOCLE false
#define GAPLESS_MONOCLE false
#define PADDINGLESS_MONOCLE false
Expand Down Expand Up @@ -87,7 +85,6 @@ bool focus_follows_pointer;
bool pointer_follows_focus;
bool pointer_follows_monitor;
bool history_aware_focus;
bool focus_by_distance;
bool ignore_ewmh_focus;
bool center_pseudo_tiled;
bool click_to_focus;
Expand Down
37 changes: 1 addition & 36 deletions tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,11 +873,7 @@ node_t *nearest_neighbor(monitor_t *m, desktop_t *d, node_t *n, direction_t dir,
nearest = nearest_from_history(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(m, d, n, dir, sel);
}
nearest = nearest_from_distance(m, d, n, dir, sel);
}
return nearest;
}
Expand Down Expand Up @@ -935,37 +931,6 @@ node_t *find_by_id_in(node_t *r, uint32_t id)
}
}

node_t *nearest_from_tree(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, node_select_t sel)
{
if (n == NULL) {
return NULL;
}

node_t *fence = find_fence(n, dir);

if (fence == NULL) {
return NULL;
}

node_t *nearest = NULL;

if (dir == DIR_NORTH || dir == DIR_WEST) {
nearest = second_extrema(fence->first_child);
} else if (dir == DIR_SOUTH || dir == DIR_EAST) {
nearest = first_extrema(fence->second_child);
}

coordinates_t ref = {m, d, n};
coordinates_t loc = {m, d, nearest};

if (nearest != NULL && (nearest->vacant ||
nearest->client == NULL || !node_matches(&loc, &ref, sel))) {
return NULL;
}

return nearest;
}

node_t *nearest_from_history(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, node_select_t sel)
{
if (n == NULL || (n->client != NULL && !IS_TILED(n->client))) {
Expand Down
1 change: 0 additions & 1 deletion tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ bool is_child(node_t *a, node_t *b);
bool is_descendant(node_t *a, node_t *b);
bool find_by_id(uint32_t id, coordinates_t *loc);
node_t *find_by_id_in(node_t *r, uint32_t id);
node_t *nearest_from_tree(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, node_select_t sel);
node_t *nearest_from_history(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, node_select_t sel);
node_t *nearest_from_distance(monitor_t *m, desktop_t *d, node_t *n, direction_t dir, node_select_t sel);
void get_opposite(direction_t src, direction_t *dst);
Expand Down

0 comments on commit 57b12d8

Please sign in to comment.