From 841a0cff2bf4cc901dd468959dfb723f54797292 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sat, 8 Aug 2020 11:57:00 +0200 Subject: [PATCH] Adding morecolor patch --- README.md | 6 ++++-- config.def.h | 3 +++ dmenu.c | 7 +++++++ patches.def.h | 6 ++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d65d664..5c2a4a7 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/) ### Changelog: -2020-08-08 - Added the symbols, managed and preselect patches +2020-08-08 - Added the symbols, managed, morecolor and preselect patches 2020-08-05 - Added the grid, highlight, highpriority, dynamic options and numbers patches @@ -89,6 +89,9 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/) - adds a `-wm` flag which sets override_redirect to false; thus letting your window manager manage the dmenu window - this may be helpful in contexts where you don't want to exclusively bind dmenu or want to treat dmenu more as a "window" rather than as an overlay + - [morecolor](https://tools.suckless.org/dmenu/patches/morecolor/) + - adds an additional color scheme for highlighting entries adjacent to the current selection + - [mouse-support](https://tools.suckless.org/dmenu/patches/mouse-support/) - adds basic mouse support for dmenu @@ -119,7 +122,6 @@ Refer to [https://tools.suckless.org/dmenu/](https://tools.suckless.org/dmenu/) - [preselect](https://tools.suckless.org/dmenu/patches/preselect/) - adds an option `-ps` to preselect an item by providing the index that should be pre-selected - * - [printinputtext](https://tools.suckless.org/dmenu/patches/printinputtext/) - this patch adds a flag (-t) which makes Return key ignore selection and print the input text to stdout diff --git a/config.def.h b/config.def.h index 5f8655d..b6b88f2 100644 --- a/config.def.h +++ b/config.def.h @@ -64,6 +64,9 @@ static const char *colors[][2] = [SchemeNorm] = { "#bbbbbb", "#222222" }, [SchemeSel] = { "#eeeeee", "#005577" }, [SchemeOut] = { "#000000", "#00ffff" }, + #if MORECOLOR_PATCH + [SchemeMid] = { "#eeeeee", "#770000" }, + #endif // MORECOLOR_PATCH #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH [SchemeSelHighlight] = { "#ffc978", "#005577" }, [SchemeNormHighlight] = { "#ffc978", "#222222" }, diff --git a/dmenu.c b/dmenu.c index 5ac25b9..c39e09b 100644 --- a/dmenu.c +++ b/dmenu.c @@ -40,6 +40,9 @@ enum { SchemeNorm, SchemeSel, SchemeOut, + #if MORECOLOR_PATCH + SchemeMid, + #endif // MORECOLOR_PATCH #if HIGHLIGHT_PATCH || FUZZYHIGHLIGHT_PATCH SchemeNormHighlight, SchemeSelHighlight, @@ -237,6 +240,10 @@ drawitem(struct item *item, int x, int y, int w) else if (item->hp) drw_setscheme(drw, scheme[SchemeHp]); #endif // HIGHPRIORITY_PATCH + #if MORECOLOR_PATCH + else if (item->left == sel || item->right == sel) + drw_setscheme(drw, scheme[SchemeMid]); + #endif // MORECOLOR_PATCH else if (item->out) drw_setscheme(drw, scheme[SchemeOut]); else diff --git a/patches.def.h b/patches.def.h index 354721c..252cc42 100644 --- a/patches.def.h +++ b/patches.def.h @@ -99,6 +99,12 @@ */ #define MANAGED_PATCH 0 +/* This patch adds an additional color scheme for highlighting entries adjacent to the current + * selection. + * https://tools.suckless.org/dmenu/patches/morecolor/ + */ +#define MORECOLOR_PATCH 0 + /* This patch adds basic mouse support for dmenu. * https://tools.suckless.org/dmenu/patches/mouse-support/ */