From 71cfb6d5531af6a1838aa8517c3ba4dd7f930024 Mon Sep 17 00:00:00 2001 From: QC Date: Sat, 4 Apr 2015 11:10:41 +0200 Subject: [PATCH] Allow urgent/active color to be set, add dmenu option -u/-a to highlight row. --- config/config.def.c | 8 +++++--- source/dialogs/dmenu.c | 12 ++++++++++++ source/xrmoptions.c | 3 +++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/config/config.def.c b/config/config.def.c index cbb6ed2b..9ada89ef 100644 --- a/config/config.def.c +++ b/config/config.def.c @@ -47,9 +47,11 @@ Settings config = { /** Font */ .menu_font = "mono 12", /** Foreground color */ - .menu_fg = "#222222", - .menu_fg_urgent = "#aa0000", - .menu_fg_active = "#00aaff", + .menu_fg = "#222222", + /** Text color used for urgent windows */ + .menu_fg_urgent = "#ff2222", + /** Text color used for active window */ + .menu_fg_active = "#2222ff", /** Background color */ .menu_bg = "#f2f1f0", /** Background color alternate row */ diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 0ad32c99..b9e94564 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -64,9 +64,19 @@ static char **get_dmenu ( int *length ) return retv; } + +static unsigned int row_urgent = 0xFFFFFFFF; +static unsigned int row_active = 0xFFFFFFFF; + static const char *get_display_data ( unsigned int index, void *data, G_GNUC_UNUSED int *state ) { char **retv = (char * *) data; + if ( index == row_urgent ) { + *state |= URGENT; + } + if ( index == row_active ) { + *state |= ACTIVE; + } return retv[index]; } @@ -87,6 +97,8 @@ int dmenu_switcher_dialog ( char **input ) // Check prompt find_arg_str ( "-p", &dmenu_prompt ); find_arg_int ( "-l", &selected_line ); + find_arg_uint ( "-u", &row_urgent ); + find_arg_uint ( "-a", &row_active ); do { int mretv = menu ( list, length, input, dmenu_prompt, diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 9e1116bb..7201e368 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -67,6 +67,9 @@ static XrmOption xrmOptions[] = { { xrm_String, "foreground", { .str = &config.menu_fg }, NULL }, { xrm_String, "fg", { .str = &config.menu_fg }, NULL }, + { xrm_String, "fg-active", { .str = &config.menu_fg_active }, NULL }, + { xrm_String, "fg-urgent", { .str = &config.menu_fg_urgent }, NULL }, + { xrm_String, "background", { .str = &config.menu_bg }, NULL }, { xrm_String, "bg", { .str = &config.menu_bg }, NULL }, { xrm_String, "background-alternate", { .str = &config.menu_bg_alt }, NULL },