]> git.lizzy.rs Git - bspwm.git/commitdiff
Add new setting: borderless_singleton
authorGeorgy Kibardin <georgy@kibardin.name>
Sat, 14 Nov 2020 11:32:24 +0000 (14:32 +0300)
committerBastien Dejean <nihilhill@gmail.com>
Thu, 24 Dec 2020 09:33:17 +0000 (10:33 +0100)
The setting is supposed to be more general solution than
`borderless_monocle`. The are two reason to have borders, first, to
indicate focused window, second, to distinguish one window from another.
There is no sense in either of above in case of the only window on the
only monitor.

contrib/bash_completion
contrib/fish_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.asciidoc
src/messages.c
src/settings.c
src/settings.h
src/tree.c

index 059612c5e8201990a9b67cf3cc413beb00dfb012..6ab1e1283f2fa8a11865e19f4d86b96c5466f6d0 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback 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 ignore_ewmh_struts 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback borderless_monocle gapless_monocle single_monocle borderless_singleton 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 ignore_ewmh_struts center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
 
        COMPREPLY=()
 
index c76cde5bd46ffacd4ee36edc5b335d969ae65925..3cd6f4d661b1ebac19af605f909efbff4e57d2cc 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback 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 ignore_ewmh_struts 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback borderless_monocle gapless_monocle single_monocle borderless_singleton 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 ignore_ewmh_struts center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
index 169198ad4719a7a0f228a6b1eaf248f70602db01..c3d0b47dd54b469693902d619bb72c47e2945afb 100644 (file)
@@ -316,7 +316,7 @@ _bspc() {
                        ;;
                (config)
                        local -a {look,behaviour,input}{_bool,}
-                       look_bool=(presel_feedback borderless_monocle gapless_monocle)
+                       look_bool=(presel_feedback borderless_monocle gapless_monocle borderless_singleton)
                        look=({normal,active,focused}_border_color {top,right,bottom,left}_padding {top,right,bottom,left}_monocle_padding presel_feedback_color border_width window_gap)
                        behaviour_bool=(single_monocle removal_adjustment ignore_ewmh_focus ignore_ewmh_struts center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors)
                        behaviour=(mapping_events_count ignore_ewmh_fullscreen external_rules_command split_ratio automatic_scheme initial_polarity directional_focus_tightness status_prefix)
index 50574b15498ef18586d53e82894f9f5fc1225f7a..e798b23921d7176e30e08e761078f37ce23384aa 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\"      Date: 12/10/2020
+.\"      Date: 12/24/2020
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.10-14-g5198399
+.\"    Source: Bspwm 0.9.10-18-g87822b5
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "12/10/2020" "Bspwm 0\&.9\&.10\-14\-g5198399" "Bspwm Manual"
+.TH "BSPWM" "1" "12/24/2020" "Bspwm 0\&.9\&.10\-18\-g87822b5" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1246,6 +1246,11 @@ Set the desktop layout to
 if there\(cqs only one tiled window in the tree\&.
 .RE
 .PP
+\fIborderless_singleton\fR
+.RS 4
+Remove borders of the only window on the only monitor regardless its layout\&.
+.RE
+.PP
 \fIpointer_motion_interval\fR
 .RS 4
 The minimum interval, in milliseconds, between two motion notify events\&.
index 27f897123e069578facca192b07768a6ca04cd7b..ca504c27e63c266b1ef235cac2e6216a8b7da9c4 100644 (file)
@@ -733,6 +733,9 @@ Global Settings
 'single_monocle'::
        Set the desktop layout to *monocle* if there's only one tiled window in the tree.
 
+'borderless_singleton'::
+       Remove borders of the only window on the only monitor regardless its layout.
+
 'pointer_motion_interval'::
        The minimum interval, in milliseconds, between two motion notify events.
 
index c10feff1fb3add4ba1e2fd7ab5ac7e2bf98fd1f1..d3852594bf1872ee7c6c97a690323bd37f5b3859 100644 (file)
@@ -1704,6 +1704,7 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                SET_BOOL(presel_feedback)
                SET_BOOL(borderless_monocle)
                SET_BOOL(gapless_monocle)
+               SET_BOOL(borderless_singleton)
                SET_BOOL(swallow_first_click)
                SET_BOOL(pointer_follows_focus)
                SET_BOOL(pointer_follows_monitor)
@@ -1833,6 +1834,7 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
        GET_BOOL(borderless_monocle)
        GET_BOOL(gapless_monocle)
        GET_BOOL(single_monocle)
+       GET_BOOL(borderless_singleton)
        GET_BOOL(swallow_first_click)
        GET_BOOL(focus_follows_pointer)
        GET_BOOL(pointer_follows_focus)
index 15f652b61e26bd6f0097391c3e91344ac1f5014f..52358f7a29c52025b1fdcc25a27c4a847b0148f3 100644 (file)
@@ -55,6 +55,7 @@ bool presel_feedback;
 bool borderless_monocle;
 bool gapless_monocle;
 bool single_monocle;
+bool borderless_singleton;
 
 bool focus_follows_pointer;
 bool pointer_follows_focus;
@@ -117,6 +118,7 @@ void load_settings(void)
        borderless_monocle = BORDERLESS_MONOCLE;
        gapless_monocle = GAPLESS_MONOCLE;
        single_monocle = SINGLE_MONOCLE;
+       borderless_singleton = BORDERLESS_SINGLETON;
 
        focus_follows_pointer = FOCUS_FOLLOWS_POINTER;
        pointer_follows_focus = POINTER_FOLLOWS_FOCUS;
index f1cb85e86b519bf8bfee6d3e04e95ae51c896316..248860d08f827c277c68ae958d7b6cf2479f1cb6 100644 (file)
@@ -49,6 +49,7 @@
 #define BORDERLESS_MONOCLE          false
 #define GAPLESS_MONOCLE             false
 #define SINGLE_MONOCLE              false
+#define BORDERLESS_SINGLETON        false
 
 #define FOCUS_FOLLOWS_POINTER       false
 #define POINTER_FOLLOWS_FOCUS       false
@@ -94,6 +95,7 @@ extern bool presel_feedback;
 extern bool borderless_monocle;
 extern bool gapless_monocle;
 extern bool single_monocle;
+extern bool borderless_singleton;
 
 extern bool focus_follows_pointer;
 extern bool pointer_follows_focus;
index 21a55729e33df795e69fc562f2a87cf44a5e611b..ec7a785a3d22e49660a53d06ec6d134c95866cae 100644 (file)
@@ -89,7 +89,9 @@ void apply_layout(monitor_t *m, desktop_t *d, node_t *n, xcb_rectangle_t rect, x
                }
 
                unsigned int bw;
+               bool the_only_window = !m->prev && !m->next && d->root->client;
                if ((borderless_monocle && d->layout == LAYOUT_MONOCLE && IS_TILED(n->client))
+                   || (borderless_singleton && the_only_window)
                    || n->client->state == STATE_FULLSCREEN) {
                        bw = 0;
                } else {