Previously this was possible via key bindings, since this operation was removed,
its useful to be able to configure which mouse keys do what.
This example swaps LMB/RMB
```
bspc config pointer_action1 resize_corner
bspc config pointer_action3 move
```
_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 leaf_monocle pointer_modifier 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 leaf_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'
COMPREPLY=()
_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' 'leaf_monocle' 'pointer_modifier' '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' 'leaf_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')
if (( CURRENT == 2 )) ; then
_values 'command' "$commands[@]"
elif (( CURRENT == 3 )) ; then
\fBmod5\fR\&.
.RE
.PP
+\fIpointer_action1\fR, \fIpointer_action2\fR, \fIpointer_action3\fR
+.RS 4
+Action performed when pressing mouse buttons 1,2 & 3\&. Accept the following values:
+\fBmove\fR,
+\fBresize_side\fR,
+\fBresize_corner\fR,
+\fBfocus\fR\&.
+.RE
+.PP
\fIclick_to_focus\fR
.RS 4
Focus a window (or a monitor) by clicking it\&.
'pointer_modifier'::
Keyboard modifier used for moving or resizing windows. Accept the following values: *shift*, *control*, *lock*, *mod1*, *mod2*, *mod3*, *mod4*, *mod5*.
+'pointer_action1', 'pointer_action2', 'pointer_action3'::
+ Action performed when pressing mouse buttons 1,2 & 3. Accept the following values: *move*, *resize_side*, *resize_corner*, *focus*.
+
'click_to_focus'::
Focus a window (or a monitor) by clicking it.
xcb_flush(dpy);
grab_pointer(ACTION_FOCUS);
} else {
- grab_pointer(ACTION_MOVE);
+ grab_pointer(pointer_actions[0]);
}
break;
case XCB_BUTTON_INDEX_2:
- grab_pointer(ACTION_RESIZE_SIDE);
+ grab_pointer(pointer_actions[1]);
break;
case XCB_BUTTON_INDEX_3:
- grab_pointer(ACTION_RESIZE_CORNER);
+ grab_pointer(pointer_actions[2]);
break;
}
}
fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
return;
}
+ } else if (streq("pointer_action1", name) ||
+ streq("pointer_action2", name) ||
+ streq("pointer_action3", name)) {
+ int index = name[14] - '1';
+ if (parse_pointer_action(value, &pointer_actions[index])) {
+ ungrab_buttons();
+ grab_buttons();
+ } else {
+ fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+ return;
+ }
} else if (streq("click_to_focus", name)) {
if (parse_bool(value, &click_to_focus)) {
ungrab_buttons();
initial_polarity = FIRST_CHILD;
pointer_modifier = POINTER_MODIFIER;
+ pointer_actions[0] = ACTION_MOVE;
+ pointer_actions[1] = ACTION_RESIZE_SIDE;
+ pointer_actions[2] = ACTION_RESIZE_CORNER;
+
borderless_monocle = BORDERLESS_MONOCLE;
gapless_monocle = GAPLESS_MONOCLE;
paddingless_monocle = PADDINGLESS_MONOCLE;
child_polarity_t initial_polarity;
uint16_t pointer_modifier;
+pointer_action_t pointer_actions[3];
bool borderless_monocle;
bool gapless_monocle;