diff --git a/config/config.def.c b/config/config.def.c index 9ada89ef..b14eac5c 100644 --- a/config/config.def.c +++ b/config/config.def.c @@ -53,13 +53,19 @@ Settings config = { /** Text color used for active window */ .menu_fg_active = "#2222ff", /** Background color */ - .menu_bg = "#f2f1f0", + .menu_bg = "#f2f1f0", + .menu_bg_urgent = "#f2f1f0", + .menu_bg_active = "#f2f1f0", /** Background color alternate row */ .menu_bg_alt = NULL, /** Foreground color (selected) */ - .menu_hlfg = "#ffffff", + .menu_hlfg = "#ffffff", + .menu_hlfg_urgent = "#ffffff", + .menu_hlfg_active = "#ffffff", /** Background color (selected) */ - .menu_hlbg = "#005577", + .menu_hlbg = "#005577", + .menu_hlbg_urgent = "#005577", + .menu_hlbg_active = "#005577", /** Border color. */ .menu_bc = "black", /** Terminal to use. (for ssh and open in terminal) */ diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index 8e89e06c..f1dc6250 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -14,6 +14,8 @@ rofi - A window switcher, run dialog and dmenu replacement [ -fg *color* ] [ -fg-urgent *color* ] [ -fg-active *color* ] +[ -bg-urgent *color* ] +[ -bg-active *color* ] [ -bg *color* ] [ -bgalt *color* ] [ -hlfg *color* ] @@ -149,6 +151,10 @@ The official website for `dmenu` can be found: http://tools.suckless.org/dmenu/ `-bg` +`-bg-active` + +`-bg-urgent` + Set the background text color (X11 named color or hex #rrggbb) for the menu. rofi -bg "#222222" @@ -181,30 +187,23 @@ The official website for `dmenu` can be found: http://tools.suckless.org/dmenu/ `-fg` +`-fg-urgent` + +`-fg-active` + Set the foreground text color (X11 named color or hex #rrggbb) for the menu. rofi -fg "#cccccc" Default: *#222222* -`-fg-urgent` - - Set the foreground text color (X11 named color or hex #rrggbb) for the menu. - - rofi -fg-urgent "#ffcccc" - - Default: *#ff2222* - -`-fg-active` - - Set the foreground text color (X11 named color or hex #rrggbb) for the menu. - - rofi -fg-active "#ccccff" - - Default: *#2222ff* `-hlbg` +`-hlbg-active` + +`-hlbg-urgent` + Set the background text color (X11 named color or hex #rrggbb) for the highlighted item in the menu. @@ -214,6 +213,10 @@ The official website for `dmenu` can be found: http://tools.suckless.org/dmenu/ `-hlfg` +`-hlfg-active` + +`-hlfg-urgent` + Set the foreground text color (X11 named color or hex #rrggbb) for the highlighted item in the menu. diff --git a/doc/rofi.1 b/doc/rofi.1 index c0b4c364..2527e6e4 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -12,6 +12,8 @@ rofi \- A window switcher, run dialog and dmenu replacement [ \-fg \fIcolor\fP ] [ \-fg\-urgent \fIcolor\fP ] [ \-fg\-active \fIcolor\fP ] +[ \-bg\-urgent \fIcolor\fP ] +[ \-bg\-active \fIcolor\fP ] [ \-bg \fIcolor\fP ] [ \-bgalt \fIcolor\fP ] [ \-hlfg \fIcolor\fP ] @@ -163,6 +165,10 @@ Do not print any message when starting in daemon mode. .SS Theming .PP \fB\fC\-bg\fR +.PP +\fB\fC\-bg\-active\fR +.PP +\fB\fC\-bg\-urgent\fR .IP Set the background text color (X11 named color or hex #rrggbb) for the menu. .PP @@ -211,6 +217,10 @@ Set the border width in pixels. Default: \fI1\fP .PP \fB\fC\-fg\fR +.PP +\fB\fC\-fg\-urgent\fR +.PP +\fB\fC\-fg\-active\fR .IP Set the foreground text color (X11 named color or hex #rrggbb) for the menu. .PP @@ -222,31 +232,11 @@ Set the foreground text color (X11 named color or hex #rrggbb) for the menu. .IP Default: \fI#222222\fP .PP -\fB\fC\-fg\-urgent\fR -.IP -Set the foreground text color (X11 named color or hex #rrggbb) for the menu. -.PP -.RS -.nf - rofi \-fg\-urgent "#ffcccc" -.fi -.RE -.IP -Default: \fI#ff2222\fP -.PP -\fB\fC\-fg\-active\fR -.IP -Set the foreground text color (X11 named color or hex #rrggbb) for the menu. -.PP -.RS -.nf - rofi \-fg\-active "#ccccff" -.fi -.RE -.IP -Default: \fI#2222ff\fP -.PP \fB\fC\-hlbg\fR +.PP +\fB\fC\-hlbg\-active\fR +.PP +\fB\fC\-hlbg\-urgent\fR .IP Set the background text color (X11 named color or hex #rrggbb) for the highlighted item in the menu. @@ -260,6 +250,10 @@ menu. Default: \fI#005577\fP .PP \fB\fC\-hlfg\fR +.PP +\fB\fC\-hlfg\-active\fR +.PP +\fB\fC\-hlfg\-urgent\fR .IP Set the foreground text color (X11 named color or hex #rrggbb) for the highlighted item in the menu. diff --git a/include/rofi.h b/include/rofi.h index db565f25..7b756a30 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -158,12 +158,18 @@ typedef struct _Settings char * menu_fg_active; /** Background color */ char * menu_bg; + char * menu_bg_urgent; + char * menu_bg_active; /** Background color alt */ char * menu_bg_alt; /** Highlight foreground color */ char * menu_hlfg; + char * menu_hlfg_urgent; + char * menu_hlfg_active; /** Highlight background color */ char * menu_hlbg; + char * menu_hlbg_urgent; + char * menu_hlbg_active; /** Border color */ char * menu_bc; /** Terminal to use */ diff --git a/source/rofi.c b/source/rofi.c index bd30efcc..82082130 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1688,7 +1688,7 @@ int main ( int argc, char *argv[] ) quiet = TRUE; } // catch help request - if ( find_arg ( "-h" ) >= 0 || find_arg ( "-help" ) >= 0 || find_arg( "--help" ) >= 0 ) { + if ( find_arg ( "-h" ) >= 0 || find_arg ( "-help" ) >= 0 || find_arg ( "--help" ) >= 0 ) { help (); exit ( EXIT_SUCCESS ); } diff --git a/source/textbox.c b/source/textbox.c index 5ca23533..06fd12fc 100644 --- a/source/textbox.c +++ b/source/textbox.c @@ -47,12 +47,20 @@ extern Display *display; * Font + font color cache. * Avoid re-loading font on every change on every textbox. */ -XftColor color_fg_urgent; -XftColor color_fg_active; +// XftColor color_fg; XftColor color_bg; +XftColor color_fg_urgent; +XftColor color_fg_active; +XftColor color_bg_urgent; +XftColor color_bg_active; +// XftColor color_hlfg; XftColor color_hlbg; +XftColor color_hlfg_urgent; +XftColor color_hlfg_active; +XftColor color_hlbg_urgent; +XftColor color_hlbg_active; XftColor color_bg_alt; XVisualInfo *visual_info; Colormap target_colormap; @@ -148,20 +156,22 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft ) if ( ( tbft & FMOD_MASK ) ) { if ( ( tbft & ACTIVE ) ) { if ( tbft & HIGHLIGHT ) { - tb->color_fg = color_hlfg; - tb->color_bg = color_fg_active; + tb->color_fg = color_hlfg_active; + tb->color_bg = color_hlbg_active; } else { tb->color_fg = color_fg_active; + tb->color_bg = color_bg_active; } } else if ( ( tbft & URGENT ) ) { if ( tbft & HIGHLIGHT ) { - tb->color_fg = color_hlfg; - tb->color_bg = color_fg_urgent; + tb->color_fg = color_hlfg_urgent; + tb->color_bg = color_hlbg_urgent; } else { tb->color_fg = color_fg_urgent; + tb->color_bg = color_bg_urgent; } } } @@ -641,12 +651,20 @@ void textbox_setup ( XVisualInfo *visual, Colormap colormap, parse_color ( visual_info->visual, target_colormap, bg, &color_bg ); parse_color ( visual_info->visual, target_colormap, fg, &color_fg ); - parse_color ( visual_info->visual, target_colormap, config.menu_fg_active, &color_fg_active ); - parse_color ( visual_info->visual, target_colormap, config.menu_fg_urgent, &color_fg_urgent ); + parse_color ( visual_info->visual, target_colormap, bg_alt, &color_bg_alt ); parse_color ( visual_info->visual, target_colormap, hlfg, &color_hlfg ); parse_color ( visual_info->visual, target_colormap, hlbg, &color_hlbg ); + parse_color ( visual_info->visual, target_colormap, config.menu_fg_active, &color_fg_active ); + parse_color ( visual_info->visual, target_colormap, config.menu_fg_urgent, &color_fg_urgent ); + parse_color ( visual_info->visual, target_colormap, config.menu_bg_active, &color_bg_active ); + parse_color ( visual_info->visual, target_colormap, config.menu_bg_urgent, &color_bg_urgent ); + parse_color ( visual_info->visual, target_colormap, config.menu_hlbg_active, &color_hlbg_active ); + parse_color ( visual_info->visual, target_colormap, config.menu_hlbg_urgent, &color_hlbg_urgent ); + parse_color ( visual_info->visual, target_colormap, config.menu_hlfg_active, &color_hlfg_active ); + parse_color ( visual_info->visual, target_colormap, config.menu_hlfg_urgent, &color_hlfg_urgent ); + PangoFontMap *font_map = pango_xft_get_font_map ( display, DefaultScreen ( display ) ); p_context = pango_font_map_create_context ( font_map ); } diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 7201e368..edb0e68b 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -53,63 +53,70 @@ typedef struct * Currently supports string, boolean and number (signed and unsigned). */ static XrmOption xrmOptions[] = { - { xrm_String, "switchers", { .str = &config.switchers }, NULL }, - { xrm_String, "modi", { .str = &config.switchers }, NULL }, - { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL }, + { xrm_String, "switchers", { .str = &config.switchers }, NULL }, + { xrm_String, "modi", { .str = &config.switchers }, NULL }, + { xrm_Number, "opacity", { .num = &config.window_opacity }, NULL }, - { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL }, + { xrm_SNumber, "width", { .snum = &config.menu_width }, NULL }, - { xrm_Number, "lines", { .num = &config.menu_lines }, NULL }, - { xrm_Number, "columns", { .num = &config.menu_columns }, NULL }, + { xrm_Number, "lines", { .num = &config.menu_lines }, NULL }, + { xrm_Number, "columns", { .num = &config.menu_columns }, NULL }, - { xrm_String, "font", { .str = &config.menu_font }, NULL }, + { xrm_String, "font", { .str = &config.menu_font }, NULL }, /* Foreground color */ - { xrm_String, "foreground", { .str = &config.menu_fg }, NULL }, - { xrm_String, "fg", { .str = &config.menu_fg }, NULL }, + { 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, "fg-active", { .str = &config.menu_fg_active }, NULL }, + { xrm_String, "fg-urgent", { .str = &config.menu_fg_urgent }, NULL }, + { xrm_String, "hlfg-active", { .str = &config.menu_hlfg_active }, NULL }, + { xrm_String, "hlfg-urgent", { .str = &config.menu_hlfg_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 }, - { xrm_String, "bgalt", { .str = &config.menu_bg_alt }, NULL }, + { xrm_String, "bg-active", { .str = &config.menu_bg_active }, NULL }, + { xrm_String, "bg-urgent", { .str = &config.menu_bg_urgent }, NULL }, + { xrm_String, "hlbg-active", { .str = &config.menu_hlbg_active }, NULL }, + { xrm_String, "hlbg-urgent", { .str = &config.menu_hlbg_urgent }, NULL }, - { xrm_String, "highlightfg", { .str = &config.menu_hlfg }, NULL }, - { xrm_String, "hlfg", { .str = &config.menu_hlfg }, 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 }, + { xrm_String, "bgalt", { .str = &config.menu_bg_alt }, NULL }, - { xrm_String, "highlightbg", { .str = &config.menu_hlbg }, NULL }, - { xrm_String, "hlbg", { .str = &config.menu_hlbg }, NULL }, + { xrm_String, "highlightfg", { .str = &config.menu_hlfg }, NULL }, + { xrm_String, "hlfg", { .str = &config.menu_hlfg }, NULL }, - { xrm_String, "bordercolor", { .str = &config.menu_bc }, NULL }, - { xrm_String, "bc", { .str = &config.menu_bc }, NULL }, + { xrm_String, "highlightbg", { .str = &config.menu_hlbg }, NULL }, + { xrm_String, "hlbg", { .str = &config.menu_hlbg }, NULL }, - { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL }, - { xrm_Number, "bw", { .num = &config.menu_bw }, NULL }, + { xrm_String, "bordercolor", { .str = &config.menu_bc }, NULL }, + { xrm_String, "bc", { .str = &config.menu_bc }, NULL }, - { xrm_Number, "location", { .num = &config.location }, NULL }, + { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL }, + { xrm_Number, "bw", { .num = &config.menu_bw }, NULL }, - { xrm_Number, "padding", { .num = &config.padding }, NULL }, - { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL }, - { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL }, - { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL }, + { xrm_Number, "location", { .num = &config.location }, NULL }, - { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL }, - { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL }, - { xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL }, - { xrm_String, "run-command", { .str = &config.run_command }, NULL }, - { xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL }, - { xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL }, + { xrm_Number, "padding", { .num = &config.padding }, NULL }, + { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL }, + { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL }, + { xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL }, - { xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL }, - { xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL }, - { xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL }, - { xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL }, - { xrm_Number, "lazy-filter-limit", { .num = &config.lazy_filter_limit }, NULL }, - { xrm_SNumber, "eh", { .snum = &config.element_height }, NULL }, - { xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL }, - { xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL }, - { xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL } + { xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL }, + { xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL }, + { xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL }, + { xrm_String, "run-command", { .str = &config.run_command }, NULL }, + { xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL }, + { xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL }, + + { xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL }, + { xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL }, + { xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL }, + { xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL }, + { xrm_Number, "lazy-filter-limit", { .num = &config.lazy_filter_limit }, NULL }, + { xrm_SNumber, "eh", { .snum = &config.element_height }, NULL }, + { xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL }, + { xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL }, + { xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL } }; // Dynamic options.