From: Bastien Dejean Date: Thu, 17 Nov 2016 17:07:26 +0000 (+0100) Subject: Add setting: swallow_first_click X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=7404946e33ba58be8be4fc933bc451b585b681b5;p=bspwm.git Add setting: swallow_first_click --- diff --git a/contrib/bash_completion b/contrib/bash_completion index c04fa57..4bc76c7 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -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_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor 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_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors' COMPREPLY=() diff --git a/contrib/fish_completion b/contrib/fish_completion index eb936f8..78da934 100644 --- a/contrib/fish_completion +++ b/contrib/fish_completion @@ -11,4 +11,4 @@ function __fish_bspc_using_command end complete -f -c bspc -n '__fish_bspc_needs_command' -a 'node desktop monitor query rule restore wm subscribe config quit' -complete -f -c bspc -n '__fish_bspc_using_command config' -a '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_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors' +complete -f -c bspc -n '__fish_bspc_using_command config' -a '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_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors' diff --git a/contrib/zsh_completion b/contrib/zsh_completion index 57281d8..f97a248 100644 --- a/contrib/zsh_completion +++ b/contrib/zsh_completion @@ -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_motion_interval' 'pointer_modifier' 'pointer_action1' 'pointer_action2' 'pointer_action3' 'click_to_focus' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' '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_motion_interval' 'pointer_modifier' 'pointer_action1' 'pointer_action2' 'pointer_action3' 'click_to_focus' 'swallow_first_click' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' '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 diff --git a/doc/bspwm.1 b/doc/bspwm.1 index ec7855e..1c36f70 100644 --- a/doc/bspwm.1 +++ b/doc/bspwm.1 @@ -2,12 +2,12 @@ .\" Title: bspwm .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 11/13/2016 +.\" Date: 11/17/2016 .\" Manual: Bspwm Manual -.\" Source: Bspwm 0.9.2-5-gb14ec64 +.\" Source: Bspwm 0.9.2-9-g201f6e6 .\" Language: English .\" -.TH "BSPWM" "1" "11/13/2016" "Bspwm 0\&.9\&.2\-5\-gb14ec64" "Bspwm Manual" +.TH "BSPWM" "1" "11/17/2016" "Bspwm 0\&.9\&.2\-9\-g201f6e6" "Bspwm Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -1111,6 +1111,13 @@ Action performed when pressing Focus a window (or a monitor) by clicking it\&. .RE .PP +\fIswallow_first_click\fR +.RS 4 +Don\(cqt replay the click that makes a window focused when +\fIclick_to_focus\fR +is set\&. +.RE +.PP \fIfocus_follows_pointer\fR .RS 4 Focus the window under the pointer\&. diff --git a/doc/bspwm.1.asciidoc b/doc/bspwm.1.asciidoc index 73ed3ea..4683164 100644 --- a/doc/bspwm.1.asciidoc +++ b/doc/bspwm.1.asciidoc @@ -650,6 +650,9 @@ Global Settings 'click_to_focus':: Focus a window (or a monitor) by clicking it. +'swallow_first_click':: + Don't replay the click that makes a window focused when 'click_to_focus' is set. + 'focus_follows_pointer':: Focus the window under the pointer. diff --git a/events.c b/events.c index 360d9ea..bbcceeb 100644 --- a/events.c +++ b/events.c @@ -341,7 +341,7 @@ void button_press(xcb_generic_event_t *evt) bool pfm = pointer_follows_monitor; pointer_follows_focus = false; pointer_follows_monitor = false; - replay = !grab_pointer(ACTION_FOCUS); + replay = !grab_pointer(ACTION_FOCUS) || !swallow_first_click; pointer_follows_focus = pff; pointer_follows_monitor = pfm; } else { diff --git a/messages.c b/messages.c index 9bd0391..fccad2e 100644 --- a/messages.c +++ b/messages.c @@ -1499,6 +1499,7 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp) SET_BOOL(gapless_monocle) SET_BOOL(paddingless_monocle) SET_BOOL(single_monocle) + SET_BOOL(swallow_first_click) SET_BOOL(pointer_follows_focus) SET_BOOL(pointer_follows_monitor) SET_BOOL(ignore_ewmh_focus) @@ -1608,6 +1609,7 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp) GET_BOOL(paddingless_monocle) GET_BOOL(single_monocle) GET_BOOL(click_to_focus) + GET_BOOL(swallow_first_click) GET_BOOL(focus_follows_pointer) GET_BOOL(pointer_follows_focus) GET_BOOL(pointer_follows_monitor) diff --git a/settings.c b/settings.c index 1af156a..a17cff5 100644 --- a/settings.c +++ b/settings.c @@ -72,6 +72,7 @@ void load_settings(void) ignore_ewmh_focus = IGNORE_EWMH_FOCUS; center_pseudo_tiled = CENTER_PSEUDO_TILED; click_to_focus = CLICK_TO_FOCUS; + swallow_first_click = SWALLOW_FIRST_CLICK; honor_size_hints = HONOR_SIZE_HINTS; remove_disabled_monitors = REMOVE_DISABLED_MONITORS; remove_unplugged_monitors = REMOVE_UNPLUGGED_MONITORS; diff --git a/settings.h b/settings.h index 47ebb6e..f8ed182 100644 --- a/settings.h +++ b/settings.h @@ -55,6 +55,7 @@ #define IGNORE_EWMH_FOCUS false #define CENTER_PSEUDO_TILED true #define CLICK_TO_FOCUS false +#define SWALLOW_FIRST_CLICK false #define HONOR_SIZE_HINTS false #define REMOVE_DISABLED_MONITORS false #define REMOVE_UNPLUGGED_MONITORS false @@ -88,6 +89,7 @@ bool pointer_follows_monitor; bool ignore_ewmh_focus; bool center_pseudo_tiled; bool click_to_focus; +bool swallow_first_click; bool honor_size_hints; bool remove_disabled_monitors; bool remove_unplugged_monitors;