Allow to disable dynamic fullscreen borders and gaps
When there are some fullscreen windows in monocle layout, it may be annoying than borders and gaps are changed when you change focus.
This commit is contained in:
parent
8dff8c8ed1
commit
709a30d70b
5 changed files with 33 additions and 12 deletions
|
@ -22,8 +22,8 @@ centeredmaster(Monitor *m)
|
||||||
|
|
||||||
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
||||||
|
|
||||||
const int gap_size = helpers_gap_size(n, is_fullscreen);
|
const int gap_size = helpers_gap_size(n, is_fullscreen, is_fullscreen);
|
||||||
const int border_width = helpers_border_width(n, is_fullscreen);
|
const int border_width = helpers_border_width(n, is_fullscreen, is_fullscreen);
|
||||||
|
|
||||||
const int top_left_half_gap = gap_size / 2;
|
const int top_left_half_gap = gap_size / 2;
|
||||||
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
||||||
|
@ -101,10 +101,15 @@ centeredmaster(Monitor *m)
|
||||||
void
|
void
|
||||||
monocle(Monitor *m)
|
monocle(Monitor *m)
|
||||||
{
|
{
|
||||||
|
bool any_is_fullscreen = false;
|
||||||
|
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||||
|
any_is_fullscreen = any_is_fullscreen || c->isfullscreen;
|
||||||
|
}
|
||||||
|
|
||||||
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
||||||
|
|
||||||
const int gap_size = helpers_gap_size(1, is_fullscreen);
|
const int gap_size = helpers_gap_size(1, is_fullscreen, any_is_fullscreen);
|
||||||
const int border_width = helpers_border_width(1, is_fullscreen);
|
const int border_width = helpers_border_width(1, is_fullscreen, any_is_fullscreen);
|
||||||
|
|
||||||
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||||
resize(
|
resize(
|
||||||
|
@ -128,8 +133,8 @@ tile(Monitor *m)
|
||||||
|
|
||||||
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
const bool is_fullscreen = m->sel == NULL ? false : m->sel->isfullscreen;
|
||||||
|
|
||||||
const int gap_size = helpers_gap_size(n, is_fullscreen);
|
const int gap_size = helpers_gap_size(n, is_fullscreen, is_fullscreen);
|
||||||
const int border_width = helpers_border_width(n, is_fullscreen);
|
const int border_width = helpers_border_width(n, is_fullscreen, is_fullscreen);
|
||||||
|
|
||||||
const int top_left_half_gap = gap_size / 2;
|
const int top_left_half_gap = gap_size / 2;
|
||||||
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
const int bottom_right_half_gap = gap_size - top_left_half_gap;
|
||||||
|
|
10
helpers.c
10
helpers.c
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
int helpers_gap_size(
|
int helpers_gap_size(
|
||||||
const unsigned int displayed_clients,
|
const unsigned int displayed_clients,
|
||||||
const bool selected_is_fullscreen
|
const bool selected_is_fullscreen,
|
||||||
|
const bool any_is_fullscreen
|
||||||
) {
|
) {
|
||||||
const SettingsForSingleWindow gap_for_single_window = settings_get_gap_for_single_window();
|
const SettingsForSingleWindow gap_for_single_window = settings_get_gap_for_single_window();
|
||||||
const int gap_size = settings_get_gap_size();
|
const int gap_size = settings_get_gap_size();
|
||||||
|
@ -18,6 +19,8 @@ int helpers_gap_size(
|
||||||
return gap_size;
|
return gap_size;
|
||||||
case SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN:
|
case SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN:
|
||||||
return selected_is_fullscreen ? 0 : gap_size;
|
return selected_is_fullscreen ? 0 : gap_size;
|
||||||
|
case SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN:
|
||||||
|
return (selected_is_fullscreen || any_is_fullscreen) ? 0 : gap_size;
|
||||||
default:
|
default:
|
||||||
// TODO: maybe we should assert here
|
// TODO: maybe we should assert here
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,7 +29,8 @@ int helpers_gap_size(
|
||||||
|
|
||||||
int helpers_border_width(
|
int helpers_border_width(
|
||||||
const unsigned int displayed_clients,
|
const unsigned int displayed_clients,
|
||||||
const bool selected_is_fullscreen
|
const bool selected_is_fullscreen,
|
||||||
|
const bool any_is_fullscreen
|
||||||
) {
|
) {
|
||||||
const SettingsForSingleWindow border_for_single_window = settings_get_border_for_single_window();
|
const SettingsForSingleWindow border_for_single_window = settings_get_border_for_single_window();
|
||||||
const int border_width = settings_get_border_width();
|
const int border_width = settings_get_border_width();
|
||||||
|
@ -40,6 +44,8 @@ int helpers_border_width(
|
||||||
return border_width;
|
return border_width;
|
||||||
case SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN:
|
case SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN:
|
||||||
return selected_is_fullscreen ? 0 : border_width;
|
return selected_is_fullscreen ? 0 : border_width;
|
||||||
|
case SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN:
|
||||||
|
return (selected_is_fullscreen || any_is_fullscreen) ? 0 : border_width;
|
||||||
default:
|
default:
|
||||||
// TODO: maybe we should assert here
|
// TODO: maybe we should assert here
|
||||||
return 0;
|
return 0;
|
||||||
|
|
13
helpers.h
13
helpers.h
|
@ -3,7 +3,16 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
int helpers_gap_size(unsigned int displayed_clients, bool selected_is_fullscreen);
|
int helpers_gap_size(
|
||||||
int helpers_border_width(unsigned int displayed_clients, bool selected_is_fullscreen);
|
unsigned int displayed_clients,
|
||||||
|
bool selected_is_fullscreen,
|
||||||
|
bool any_is_fullscreen
|
||||||
|
);
|
||||||
|
|
||||||
|
int helpers_border_width(
|
||||||
|
unsigned int displayed_clients,
|
||||||
|
bool selected_is_fullscreen,
|
||||||
|
bool any_is_fullscreen
|
||||||
|
);
|
||||||
|
|
||||||
#endif // _HELPERS_H
|
#endif // _HELPERS_H
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
static int border_width = 2;
|
static int border_width = 2;
|
||||||
static int default_clients_in_master = 1;
|
static int default_clients_in_master = 1;
|
||||||
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN;
|
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
||||||
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN;
|
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
|
||||||
static bool enable_swallowing = true;
|
static bool enable_swallowing = true;
|
||||||
static bool focus_on_wheel = true;
|
static bool focus_on_wheel = true;
|
||||||
static int gap_size = 10;
|
static int gap_size = 10;
|
||||||
|
|
|
@ -7,6 +7,7 @@ typedef enum {
|
||||||
SETTINGS_FOR_SINGLE_WINDOW_NEVER,
|
SETTINGS_FOR_SINGLE_WINDOW_NEVER,
|
||||||
SETTINGS_FOR_SINGLE_WINDOW_ALWAYS,
|
SETTINGS_FOR_SINGLE_WINDOW_ALWAYS,
|
||||||
SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN,
|
SETTINGS_FOR_SINGLE_WINDOW_NOT_IN_FULLSCREEN,
|
||||||
|
SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN,
|
||||||
} SettingsForSingleWindow;
|
} SettingsForSingleWindow;
|
||||||
|
|
||||||
int settings_get_border_width();
|
int settings_get_border_width();
|
||||||
|
|
Loading…
Reference in a new issue