_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 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 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'
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' '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' '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')
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: 08/16/2014
+.\" Date: 10/22/2014
.\" Manual: Bspwm Manual
.\" Source: Bspwm 0.8.9
.\" Language: English
.\"
-.TH "BSPWM" "1" "08/16/2014" "Bspwm 0\&.8\&.9" "Bspwm Manual"
+.TH "BSPWM" "1" "10/22/2014" "Bspwm 0\&.8\&.9" "Bspwm Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
Focus the window under the pointer\&.
.RE
.PP
+\fIpointer_follows_focus\fR
+.RS 4
+When focusing a window, put the pointer at its center\&.
+.RE
+.PP
\fIpointer_follows_monitor\fR
.RS 4
When focusing a monitor, put the pointer at its center\&.
'focus_follows_pointer'::
Focus the window under the pointer.
+'pointer_follows_focus'::
+ When focusing a window, put the pointer at its center.
+
'pointer_follows_monitor'::
When focusing a monitor, put the pointer at its center.
return MSG_FAILURE;
SETBOOL(borderless_monocle)
SETBOOL(gapless_monocle)
+ SETBOOL(pointer_follows_focus)
SETBOOL(pointer_follows_monitor)
SETBOOL(apply_floating_atom)
SETBOOL(auto_alternate)
GETBOOL(borderless_monocle)
GETBOOL(gapless_monocle)
GETBOOL(focus_follows_pointer)
+ GETBOOL(pointer_follows_focus)
GETBOOL(pointer_follows_monitor)
GETBOOL(apply_floating_atom)
GETBOOL(auto_alternate)
mon = m;
if (pointer_follows_monitor)
- center_pointer(m);
+ center_pointer(m->rectangle);
ewmh_update_current_desktop();
put_status();
borderless_monocle = BORDERLESS_MONOCLE;
gapless_monocle = GAPLESS_MONOCLE;
focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
+ pointer_follows_focus = POINTER_FOLLOWS_FOCUS;
pointer_follows_monitor = POINTER_FOLLOWS_MONITOR;
apply_floating_atom = APPLY_FLOATING_ATOM;
auto_alternate = AUTO_ALTERNATE;
#define BORDERLESS_MONOCLE false
#define GAPLESS_MONOCLE false
#define FOCUS_FOLLOWS_POINTER false
+#define POINTER_FOLLOWS_FOCUS false
#define POINTER_FOLLOWS_MONITOR false
#define AUTO_ALTERNATE false
#define AUTO_CANCEL false
bool borderless_monocle;
bool gapless_monocle;
bool focus_follows_pointer;
+bool pointer_follows_focus;
bool pointer_follows_monitor;
bool apply_floating_atom;
bool auto_alternate;
window_border_width(n->client->window, bw);
window_draw_border(n, d->focus == n, m == mon);
+ if (pointer_follows_focus && mon->desk->focus == n && frozen_pointer->action == ACTION_NONE) {
+ center_pointer(r);
+ }
+
} else {
xcb_rectangle_t first_rect;
xcb_rectangle_t second_rect;
disable_motion_recorder();
}
+ if (pointer_follows_focus) {
+ center_pointer(get_rectangle(n->client));
+ }
+
ewmh_update_active_window();
}
xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, root, XCB_CURRENT_TIME);
}
-void center_pointer(monitor_t *m)
+void center_pointer(xcb_rectangle_t r)
{
- int16_t cx = m->rectangle.x + m->rectangle.width / 2;
- int16_t cy = m->rectangle.y + m->rectangle.height / 2;
+ int16_t cx = r.x + r.width / 2;
+ int16_t cy = r.y + r.height / 2;
window_lower(motion_recorder);
xcb_warp_pointer(dpy, XCB_NONE, root, 0, 0, 0, 0, cx, cy);
window_raise(motion_recorder);
void update_input_focus(void);
void set_input_focus(node_t *n);
void clear_input_focus(void);
-void center_pointer(monitor_t *m);
+void center_pointer(xcb_rectangle_t r);
void get_atom(char *name, xcb_atom_t *atom);
void set_atom(xcb_window_t win, xcb_atom_t atom, uint32_t value);
bool has_proto(xcb_atom_t atom, xcb_icccm_get_wm_protocols_reply_t *protocols);