1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add more user-colors.

This commit is contained in:
QC 2015-04-06 15:23:58 +02:00
parent f857143e2c
commit 39518b0e15
7 changed files with 128 additions and 94 deletions

View file

@ -54,12 +54,18 @@ Settings config = {
.menu_fg_active = "#2222ff",
/** Background color */
.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_urgent = "#ffffff",
.menu_hlfg_active = "#ffffff",
/** Background color (selected) */
.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) */

View file

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

View file

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

View file

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

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -69,6 +69,13 @@ static XrmOption xrmOptions[] = {
{ 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, "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, "background", { .str = &config.menu_bg }, NULL },
{ xrm_String, "bg", { .str = &config.menu_bg }, NULL },