From c0611034aa80be54b8dba26d454d7c2c93dd631d Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 21 Apr 2023 12:10:02 +0200 Subject: [PATCH] add a keybind for toggling highlighting --- keybinds.h | 1 + libs/arg.c | 7 +++++++ libs/arg.h | 1 + 3 files changed, 9 insertions(+) diff --git a/keybinds.h b/keybinds.h index c8ea656..179dc7a 100644 --- a/keybinds.h +++ b/keybinds.h @@ -88,6 +88,7 @@ static Key keys[] = { { 0, CONTROL|ALT|SHIFT, XK_h, setcolumns, {.i = +5 } }, { 0, CONTROL|ALT|SHIFT, XK_l, setcolumns, {.i = -5 } }, { 0, CONTROL, XK_k, restoresel, {0} }, + { 0, 0, XK_u, togglehighlight, {0} }, { 0, CONTROL|SHIFT, XK_h, viewhist, {0} }, { 0, 0, XK_d, clear, {0} }, { 0, 0, XK_c, clearins, {0} }, diff --git a/libs/arg.c b/libs/arg.c index c24f3ed..fe029eb 100644 --- a/libs/arg.c +++ b/libs/arg.c @@ -532,3 +532,10 @@ spawn(const Arg *arg) fprintf(stderr, "spmenu: failed to execute command '%s'", ((char **)arg->v)[0]); } } + +void +togglehighlight(const Arg *arg) +{ + hidehighlight = !hidehighlight; + drawmenu(); +} diff --git a/libs/arg.h b/libs/arg.h index 3b425ea..8bac262 100644 --- a/libs/arg.h +++ b/libs/arg.h @@ -39,3 +39,4 @@ static void setlines(const Arg *arg); static void setcolumns(const Arg *arg); static void setprofile(const Arg *arg); static void spawn(const Arg *arg); +static void togglehighlight(const Arg *arg);