Skip to content

Commit

Permalink
Add new setting: borderless_singleton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
shashurup authored and baskerville committed Dec 24, 2020
1 parent 0510d97 commit 7012d99
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contrib/bash_completion
Original file line number Diff line number Diff line change
@@ -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=()

Expand Down
2 changes: 1 addition & 1 deletion contrib/fish_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion contrib/zsh_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions doc/bspwm.1
Original file line number Diff line number Diff line change
Expand Up @@ -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
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -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\&.
Expand Down
3 changes: 3 additions & 0 deletions doc/bspwm.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7012d99

Please sign in to comment.