]> git.lizzy.rs Git - bspwm.git/commitdiff
Add setting: ignore_ewmh_fullscreen
authorBastien Dejean <nihilhill@gmail.com>
Wed, 14 Mar 2018 09:45:02 +0000 (10:45 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Wed, 14 Mar 2018 09:45:02 +0000 (10:45 +0100)
Fixes #343.
Fixes #643.

14 files changed:
contrib/bash_completion
contrib/fish_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.asciidoc
src/events.c
src/messages.c
src/parse.c
src/parse.h
src/query.c
src/query.h
src/settings.c
src/settings.h
src/types.h

index d8c41e7b2c1e0e5bdd4be28305f39ec07a777a1d..35c1f298352e3f25eb4f3f79288ae83096f26206 100644 (file)
@@ -1,7 +1,7 @@
 _bspc() {
        local commands='node desktop monitor query rule 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 directional_focus_tightness 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 mapping_events_count 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 directional_focus_tightness 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 mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
 
        COMPREPLY=()
 
index b1c37c9cbfc745cdaa21d006da5c29b057d16228..940ad07260632db148f2fec5ccb0d24234aea8f5 100644 (file)
@@ -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 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 directional_focus_tightness 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 mapping_events_count 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 directional_focus_tightness 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 mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
index cc97da3bdd605ec131f9f7e5d2bf971c27ccec09..3e92a0126d35fee87a1a96d120846eaf9a0a4317 100644 (file)
@@ -315,7 +315,7 @@ _bspc() {
                        local -a look behaviour input
                        # Boolean settings are identified by index!
                        look=(borderless_monocle gapless_monocle {normal,active,focused}_border_color {top,right,bottom,left}_padding presel_feedback_color border_width window_gap)
-                       behaviour=(single_monocle mapping_events_count ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors status_prefix external_rules_command split_ratio initial_polarity directional_focus_tightness status_prefix)
+                       behaviour=(single_monocle mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors status_prefix external_rules_command split_ratio initial_polarity directional_focus_tightness status_prefix)
                        input=({swallow_first_click,focus_follows_pointer,pointer_follows_{focus,monitor}} click_to_focus pointer_motion_interval pointer_modifier pointer_action{1,2,3} )
                        if [[ "$CURRENT" == (2|3) ]];then
                                _arguments \
index 053cc82da14a4beb45b686abce0988b16c229166..00cd6098bfdd911fdef2872cbd943fde24c93cff 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 03/07/2018
+.\"      Date: 03/14/2018
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.3-57-g582a843
+.\"    Source: Bspwm 0.9.3-59-g14d575a
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "03/07/2018" "Bspwm 0\&.9\&.3\-57\-g582a843" "Bspwm Manual"
+.TH "BSPWM" "1" "03/14/2018" "Bspwm 0\&.9\&.3\-59\-g14d575a" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1266,6 +1266,15 @@ mapping notify events\&. A negative value implies that every event needs to be h
 Ignore EWMH focus requests coming from applications\&.
 .RE
 .PP
+\fIignore_ewmh_fullscreen\fR
+.RS 4
+Block the fullscreen state transitions that originate from an EWMH request\&. The possible values are:
+\fBnone\fR,
+\fBall\fR, or a comma separated list of the following values:
+\fBenter\fR,
+\fBexit\fR\&.
+.RE
+.PP
 \fIcenter_pseudo_tiled\fR
 .RS 4
 Center pseudo tiled windows into their tiling rectangles\&. Defaults to
index 9dc011f876df530cf8e6998db117bfad1aded50c..7f5ff60e4e06bbbc4e5c4a7ad582bd93e7762183 100644 (file)
@@ -724,6 +724,9 @@ Global Settings
 'ignore_ewmh_focus'::
        Ignore EWMH focus requests coming from applications.
 
+'ignore_ewmh_fullscreen'::
+       Block the fullscreen state transitions that originate from an EWMH request. The possible values are: *none*, *all*, or a comma separated list of the following values: *enter*, *exit*.
+
 'center_pseudo_tiled'::
        Center pseudo tiled windows into their tiling rectangles. Defaults to 'true'.
 
index 7984a7eaac1b6ba2562ad9f796ed60ce9f0df0b4..4de3fa6f4e95b994359bc38ad66a946f0364bab6 100644 (file)
@@ -448,14 +448,18 @@ void motion_notify(xcb_generic_event_t *evt)
 void handle_state(monitor_t *m, desktop_t *d, node_t *n, xcb_atom_t state, unsigned int action)
 {
        if (state == ewmh->_NET_WM_STATE_FULLSCREEN) {
-               if (action == XCB_EWMH_WM_STATE_ADD) {
+               if (action == XCB_EWMH_WM_STATE_ADD && (ignore_ewmh_fullscreen & STATE_TRANSITION_ENTER) == 0) {
                        set_state(m, d, n, STATE_FULLSCREEN);
-               } else if (action == XCB_EWMH_WM_STATE_REMOVE) {
+               } else if (action == XCB_EWMH_WM_STATE_REMOVE && (ignore_ewmh_fullscreen & STATE_TRANSITION_EXIT) == 0) {
                        if (n->client->state == STATE_FULLSCREEN) {
                                set_state(m, d, n, n->client->last_state);
                        }
                } else if (action == XCB_EWMH_WM_STATE_TOGGLE) {
-                       set_state(m, d, n, IS_FULLSCREEN(n->client) ? n->client->last_state : STATE_FULLSCREEN);
+                       client_state_t next_state = IS_FULLSCREEN(n->client) ? n->client->last_state : STATE_FULLSCREEN;
+                       if ((next_state == STATE_FULLSCREEN && (ignore_ewmh_fullscreen & STATE_TRANSITION_ENTER) == 0) ||
+                           (next_state != STATE_FULLSCREEN && (ignore_ewmh_fullscreen & STATE_TRANSITION_EXIT) == 0)) {
+                               set_state(m, d, n, next_state);
+                       }
                }
                arrange(m, d);
        } else if (state == ewmh->_NET_WM_STATE_BELOW) {
index 6d9d970323cb749178496157d03ff2b29845a720..0ed08660a0849948bd4ec9e9de2cc24e13578316 100644 (file)
@@ -1568,6 +1568,14 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                        fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
                        return;
                }
+       } else if (streq("ignore_ewmh_fullscreen", name)) {
+               state_transition_t m;
+               if (parse_state_transition(value, &m)) {
+                       ignore_ewmh_fullscreen = m;
+               } else {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+                       return;
+               }
        } else if (streq("pointer_modifier", name)) {
                if (parse_modifier_mask(value, &pointer_modifier)) {
                        ungrab_buttons();
@@ -1727,6 +1735,8 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
                fprintf(rsp, "%" PRIi8, mapping_events_count);
        } else if (streq("directional_focus_tightness", name)) {
                fprintf(rsp, "%s", TIGHTNESS_STR(directional_focus_tightness));
+       } else if (streq("ignore_ewmh_fullscreen", name)) {
+               print_ignore_request(ignore_ewmh_fullscreen, rsp);
        } else if (streq("pointer_modifier", name)) {
                print_modifier_mask(pointer_modifier, rsp);
        } else if (streq("click_to_focus", name)) {
index 4ceb3a9fbc6b13b2e6f0e805faecec043478dc1d..f7dc1d8e8cfc68024482f32b071ba41ef0f6f9e5 100644 (file)
@@ -267,6 +267,40 @@ bool parse_child_polarity(char *s, child_polarity_t *p)
        return false;
 }
 
+bool parse_state_transition(char *s, state_transition_t *m)
+{
+       if (streq("none", s)) {
+               *m = 0;
+               return true;
+       } else if (streq("all", s)) {
+               *m = STATE_TRANSITION_ENTER | STATE_TRANSITION_EXIT;
+               return true;
+       } else {
+               state_transition_t w = 0;
+               char *x = copy_string(s, strlen(s));
+               char *key = strtok(x, ",");
+               while (key != NULL) {
+                       if (streq("enter", key)) {
+                               w |= STATE_TRANSITION_ENTER;
+                       } else if (streq("exit", key)) {
+                               w |= STATE_TRANSITION_EXIT;
+                       } else {
+                               free(x);
+                               return false;
+                       }
+                       key = strtok(NULL, ",");
+               }
+               free(x);
+               if (w != 0) {
+                       *m = w;
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+       return false;
+}
+
 bool parse_tightness(char *s, tightness_t *t)
 {
        if (streq("high", s)) {
index bc505ffbad87a6e6ce4114156397093f39e33993..370c08f8baf9b3b8397b6fb692b67fd3728cecbe 100644 (file)
@@ -25,6 +25,7 @@ bool parse_modifier_mask(char *s, uint16_t *m);
 bool parse_button_index(char *s, int8_t *b);
 bool parse_pointer_action(char *s, pointer_action_t *a);
 bool parse_child_polarity(char *s, child_polarity_t *p);
+bool parse_state_transition(char *s, state_transition_t *m);
 bool parse_tightness(char *s, tightness_t *t);
 bool parse_degree(char *s, int *d);
 bool parse_id(char *s, uint32_t *id);
index f1c9c91c29f79910b6654758ead5eb4b607b7b27..bf28afa8c6e022ed2ca6343bc4b3ba43d77ec4ca 100644 (file)
@@ -312,6 +312,22 @@ void fprint_desktop_name(desktop_t *d, FILE *rsp)
        fprintf(rsp, "%s\n", d->name);
 }
 
+void print_ignore_request(state_transition_t st, FILE *rsp)
+{
+       if (st == 0) {
+               fprintf(rsp, "none");
+       } else {
+               unsigned int cnt = 0;
+               if (st & STATE_TRANSITION_ENTER) {
+                       fprintf(rsp, "enter");
+                       cnt++;
+               }
+               if (st & STATE_TRANSITION_EXIT) {
+                       fprintf(rsp, "%sexit", cnt > 0 ? "," : "");
+               }
+       }
+}
+
 void print_modifier_mask(uint16_t m, FILE *rsp)
 {
        switch (m) {
index 3f66983b5c8e1b979e59aea066b7b0cffb5f7384..631336fe86744525a59dc977f56d4e6ca022e530 100644 (file)
@@ -64,6 +64,7 @@ void fprint_monitor_id(monitor_t *m, FILE *rsp);
 void fprint_monitor_name(monitor_t *m, FILE *rsp);
 void fprint_desktop_id(desktop_t *d, FILE *rsp);
 void fprint_desktop_name(desktop_t *d, FILE *rsp);
+void print_ignore_request(state_transition_t st, FILE *rsp);
 void print_modifier_mask(uint16_t m, FILE *rsp);
 void print_button_index(int8_t b, FILE *rsp);
 void print_pointer_action(pointer_action_t a, FILE *rsp);
index 857340956ef9038d68f177e657614e59c2f76620..f8390b8a2fdec1aad87db896dcf2c76a4b82ea6f 100644 (file)
@@ -77,6 +77,7 @@ void load_settings(void)
        click_to_focus = CLICK_TO_FOCUS;
        swallow_first_click = SWALLOW_FIRST_CLICK;
        ignore_ewmh_focus = IGNORE_EWMH_FOCUS;
+       ignore_ewmh_fullscreen = IGNORE_EWMH_FULLSCREEN;
 
        center_pseudo_tiled = CENTER_PSEUDO_TILED;
        honor_size_hints = HONOR_SIZE_HINTS;
index df59e56272a3b00b2d36fc11e8d60e12d8c3122d..f5f1293c4e32f1a24a1e69bfb60fba522abf80be 100644 (file)
@@ -53,6 +53,7 @@
 #define CLICK_TO_FOCUS              -1
 #define SWALLOW_FIRST_CLICK         false
 #define IGNORE_EWMH_FOCUS           false
+#define IGNORE_EWMH_FULLSCREEN      0
 
 #define CENTER_PSEUDO_TILED         true
 #define HONOR_SIZE_HINTS            false
@@ -93,6 +94,7 @@ bool pointer_follows_monitor;
 int8_t click_to_focus;
 bool swallow_first_click;
 bool ignore_ewmh_focus;
+state_transition_t ignore_ewmh_fullscreen;
 
 bool center_pseudo_tiled;
 bool honor_size_hints;
index 712fdb8df5ccc19a74bdf246cc0d5fb7c985883b..1703d2181b804e00d57f21cd74f1a1883c55cb6e 100644 (file)
@@ -144,6 +144,11 @@ typedef enum {
        TIGHTNESS_HIGH,
 } tightness_t;
 
+typedef enum {
+       STATE_TRANSITION_ENTER = 1 << 0,
+       STATE_TRANSITION_EXIT = 1 << 1,
+} state_transition_t;
+
 typedef struct {
        option_bool_t automatic;
        option_bool_t focused;