Allow urgent/active color to be set, add dmenu option -u/-a to highlight row.

This commit is contained in:
QC 2015-04-04 11:10:41 +02:00
parent f2c4aff37c
commit 71cfb6d553
3 changed files with 20 additions and 3 deletions

View File

@ -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 */

View File

@ -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,

View File

@ -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 },