diff options
author | Vasil Zlatanov <v@skozl.com> | 2017-08-22 20:31:01 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2017-08-28 19:29:32 +0200 |
commit | 71819fe746d57774aaa05d989ab932dc39076d90 (patch) | |
tree | a903882b293240a3d6584514dd6cabfca5ad1ef4 | |
parent | 53618de3a1d83860b86f4d4a1a2a400d386d7645 (diff) | |
download | ratpoison-71819fe746d57774aaa05d989ab932dc39076d90.zip |
add onlyborder variable
When onlyborder is set to 0 (default 1), borders are not displayed if
there is only a single frame on a given screen.
This is useful if you use (thick) coloured borders to show which is the
currently focused window when using splits, but also don't want to have
borders taking up space unnecessarily when running a fullscreen window.
Signed-off-by: Vasil Zlatanov <v@skozl.com>
-rw-r--r-- | doc/ratpoison.mdoc.1 | 11 | ||||
-rw-r--r-- | src/actions.c | 25 | ||||
-rw-r--r-- | src/data.h | 1 | ||||
-rw-r--r-- | src/main.c | 1 | ||||
-rw-r--r-- | src/manage.c | 7 |
5 files changed, 43 insertions, 2 deletions
diff --git a/doc/ratpoison.mdoc.1 b/doc/ratpoison.mdoc.1 index 502bd9f..db54a07 100644 --- a/doc/ratpoison.mdoc.1 +++ b/doc/ratpoison.mdoc.1 @@ -22,7 +22,7 @@ .\" [2] http://mdocml.bsd.lv/ .\" [3] http://mdocml.bsd.lv/mdoc.7.html .\" -.Dd May 6, 2017 +.Dd Aug 22, 2017 .Dt RATPOISON 1 .Os .Sh NAME @@ -995,6 +995,15 @@ Selects how thick the frame around windows is. .Pp Default is .Li 1 . +.It Cm onlyborder Li 0 | 1 +Determine whether to show borders +.Pq Li 1 +or not +.Pq Li 0 +when there is only one frame on the screen. +.Pp +Default is +.Li 1 . .It Cm barborder Ar pixels Selects how thick the frame around .Nm Ap diff --git a/src/actions.c b/src/actions.c index 21237ee..60e90e9 100644 --- a/src/actions.c +++ b/src/actions.c @@ -156,6 +156,7 @@ static cmdret * set_bargravity (struct cmdarg **args); static cmdret * set_font (struct cmdarg **args); static cmdret * set_padding (struct cmdarg **args); static cmdret * set_border (struct cmdarg **args); +static cmdret * set_onlyborder(struct cmdarg **args); static cmdret * set_barborder (struct cmdarg **args); static cmdret * set_barinpadding (struct cmdarg **args); static cmdret * set_inputwidth (struct cmdarg **args); @@ -345,6 +346,7 @@ init_set_vars (void) add_set_var ("barpadding", set_barpadding, 2, "", arg_NUMBER, "", arg_NUMBER); add_set_var ("bgcolor", set_bgcolor, 1, "", arg_STRING); add_set_var ("border", set_border, 1, "", arg_NUMBER); + add_set_var ("onlyborder", set_onlyborder, 1, "", arg_NUMBER); add_set_var ("bwcolor", set_bwcolor, 1, "", arg_STRING); add_set_var ("fgcolor", set_fgcolor, 1, "", arg_STRING); add_set_var ("font", set_font, 1, "", arg_STRING); @@ -4170,6 +4172,29 @@ set_border (struct cmdarg **args) } static cmdret * +set_onlyborder (struct cmdarg **args) +{ + rp_window *win; + + if (args[0] == NULL) + return cmdret_new (RET_SUCCESS, "%d", defaults.only_border); + + if (ARG(0, number) != 0 && ARG(0, number) != 1) + return cmdret_new (RET_FAILURE, "set onlyborder: invalid argument"); + + defaults.only_border = ARG(0, number); + + /* Update all the visible windows. */ + list_for_each_entry (win,&rp_mapped_window,node) + { + if (win_get_frame (win)) + maximize (win); + } + + return cmdret_new (RET_SUCCESS, NULL); +} + +static cmdret * set_barborder (struct cmdarg **args) { rp_screen *cur; @@ -243,6 +243,7 @@ struct rp_defaults int input_window_size; int window_border_width; + int only_border; int bar_x_padding; int bar_y_padding; @@ -519,6 +519,7 @@ init_defaults (void) defaults.input_window_size = 200; defaults.window_border_width = 1; + defaults.only_border = 1; defaults.bar_x_padding = 4; defaults.bar_y_padding = 0; defaults.bar_location = NorthEastGravity; diff --git a/src/manage.c b/src/manage.c index 91f046b..073235f 100644 --- a/src/manage.c +++ b/src/manage.c @@ -686,7 +686,12 @@ maximize_normal (rp_window *win) return; /* Set the window's border */ - win->border = defaults.window_border_width; + if (defaults.only_border == 0 && num_frames(win->scr) <= 1){ + win->border = 0; + } else { + win->border = defaults.window_border_width; + } + /* Honour the window's maximum size */ if (win->hints->flags & PMaxSize) |