From 0988babd15e3dd3d3f4e23fc740e09101146924f Mon Sep 17 00:00:00 2001 From: speedie Date: Sun, 16 Jul 2023 18:59:08 +0200 Subject: [PATCH] Add setlineheight function --- docs/docs.md | 2 ++ libs/arg.c | 6 ++++++ libs/arg.h | 1 + libs/conf/config.h | 1 + libs/wl/wayland.c | 1 - libs/x11/client.c | 1 - 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/docs.md b/docs/docs.md index f577edc..706f876 100644 --- a/docs/docs.md +++ b/docs/docs.md @@ -1015,6 +1015,8 @@ bind: - Set lines to passed argument - `setcolumns` - Set columns to passed argument +- `setlineheight` + - Set line height to passed argument - `setprofile` - Open profile menu if available - `switchmode` diff --git a/libs/arg.c b/libs/arg.c index 55549f3..52691cc 100644 --- a/libs/arg.c +++ b/libs/arg.c @@ -395,6 +395,12 @@ out: free(history); } +void setlineheight(Arg *arg) { + lineheight += arg->i; + sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight); + resizeclient(); +} + void setimgsize(Arg *arg) { #if USEIMAGE setimagesize(img.imagewidth + arg->i, img.imageheight + arg->i); diff --git a/libs/arg.h b/libs/arg.h index b89a3e6..5d73d39 100644 --- a/libs/arg.h +++ b/libs/arg.h @@ -56,6 +56,7 @@ static void spawn(Arg *arg); static void screenshot(Arg *arg); static void switchmode(Arg *arg); static void setprofile(Arg *arg); +static void setlineheight(Arg *arg); static void quit(Arg *arg); /* toggle */ diff --git a/libs/conf/config.h b/libs/conf/config.h index 7daae6c..68053fc 100644 --- a/libs/conf/config.h +++ b/libs/conf/config.h @@ -392,6 +392,7 @@ static FuncList fl[] = { { "toggleregex", toggleregex }, { "toggleimg", toggleimg }, { "setprofile", setprofile }, + { "setlineheight", setlineheight }, { "switchmode", switchmode }, { "spawn", spawn }, }; diff --git a/libs/wl/wayland.c b/libs/wl/wayland.c index 9c82733..a2d672c 100644 --- a/libs/wl/wayland.c +++ b/libs/wl/wayland.c @@ -540,7 +540,6 @@ void resizeclient_wl(struct state *state) { for (item = items; item && item->text; item++) ic++; - sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight); lines = MIN(ic, MAX(lines, 0)); #if USEIMAGE img.setlines = lines; diff --git a/libs/x11/client.c b/libs/x11/client.c index 6c84ded..bb86b16 100644 --- a/libs/x11/client.c +++ b/libs/x11/client.c @@ -79,7 +79,6 @@ void resizeclient_x11(void) { for (item = items; item && item->text; item++) ic++; - sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight); lines = MIN(ic, MAX(lines, 0)); #if USEIMAGE img.setlines = lines;