mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Re-enable background/foreground. Make theming method an option.
This commit is contained in:
parent
27dfb8937d
commit
c1a8735e24
7 changed files with 77 additions and 67 deletions
|
@ -47,34 +47,36 @@ Settings config = {
|
|||
/** Font */
|
||||
.menu_font = "mono 12",
|
||||
|
||||
/** Background color */
|
||||
.menu_bg = NULL,
|
||||
/** Border color. */
|
||||
.menu_bc = NULL,
|
||||
/** Row colors */
|
||||
.color_normal = "#fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5",
|
||||
.color_urgent = "#fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3",
|
||||
.color_active = "#fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3",
|
||||
.color_window = "#fdf6e3,#002b36",
|
||||
// Enable new color
|
||||
.color_enabled = FALSE,
|
||||
.color_normal = "#fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5",
|
||||
.color_urgent = "#fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3",
|
||||
.color_active = "#fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3",
|
||||
.color_window = "#fdf6e3,#002b36",
|
||||
|
||||
/** Background color */
|
||||
.menu_bg = "#FDF6E3",
|
||||
/** Border color. */
|
||||
.menu_bc = "#002B36",
|
||||
/** Foreground color */
|
||||
.menu_fg = NULL,
|
||||
.menu_fg = "#002B36",
|
||||
/** Text color used for urgent windows */
|
||||
.menu_fg_urgent = NULL,
|
||||
.menu_fg_urgent = "#DC322F",
|
||||
/** Text color used for active window */
|
||||
.menu_fg_active = NULL,
|
||||
.menu_bg_urgent = NULL,
|
||||
.menu_bg_active = NULL,
|
||||
.menu_fg_active = "#268BD2",
|
||||
.menu_bg_urgent = "#FDF6E3",
|
||||
.menu_bg_active = "#FDF6E3",
|
||||
/** Background color alternate row */
|
||||
.menu_bg_alt = NULL,
|
||||
.menu_bg_alt = "#EEE8D5",
|
||||
/** Foreground color (selected) */
|
||||
.menu_hlfg = NULL,
|
||||
.menu_hlfg_urgent = NULL,
|
||||
.menu_hlfg_active = NULL,
|
||||
.menu_hlfg = "#EEE8D5",
|
||||
.menu_hlfg_urgent = "#FDF6E3",
|
||||
.menu_hlfg_active = "#FDF6E3",
|
||||
/** Background color (selected) */
|
||||
.menu_hlbg = NULL,
|
||||
.menu_hlbg_urgent = NULL,
|
||||
.menu_hlbg_active = NULL,
|
||||
.menu_hlbg = "#586E75",
|
||||
.menu_hlbg_urgent = "#DC322F",
|
||||
.menu_hlbg_active = "#268BD2",
|
||||
/** Terminal to use. (for ssh and open in terminal) */
|
||||
.terminal_emulator = "x-terminal-emulator",
|
||||
.ssh_client = "ssh",
|
||||
|
|
|
@ -506,8 +506,9 @@ override xresources).
|
|||
|
||||
## Theming
|
||||
|
||||
With **rofi** 0.15.4 we have a new way of specifying colors, the old settings still apply (for now)
|
||||
and override the new setup. The new setup allows you to specify colors per state, similar to **i3**
|
||||
With **rofi** 0.15.4 we have a new way of specifying colors, the old settings still apply (for now).
|
||||
To enable the new setup, set `rofi.color-enabled` to true. The new setup allows you to specify
|
||||
colors per state, similar to **i3**
|
||||
Currently 3 states exists:
|
||||
|
||||
* **normal** Normal row.
|
||||
|
@ -527,7 +528,7 @@ a pair `background,border`.
|
|||
An example for `Xresources` file:
|
||||
|
||||
```
|
||||
! State: 'bg', 'fg', 'bgalt', 'hlfg', 'hlbg'
|
||||
! State: 'bg', 'fg', 'bgalt', 'hlbg', 'hlfg'
|
||||
rofi.color-normal: #fdf6e3, #002b36, #eee8d5, #586e75, #eee8d5
|
||||
rofi.color-urgent: #fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3
|
||||
rofi.color-active: #fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3
|
||||
|
|
|
@ -633,8 +633,9 @@ If in daemon mode, reload the configuration from Xresources. (commandline argume
|
|||
override xresources).
|
||||
.SH Theming
|
||||
.PP
|
||||
With \fBrofi\fP 0.15.4 we have a new way of specifying colors, the old settings still apply (for now)
|
||||
and override the new setup. The new setup allows you to specify colors per state, similar to \fBi3\fP
|
||||
With \fBrofi\fP 0.15.4 we have a new way of specifying colors, the old settings still apply (for now).
|
||||
To enable the new setup, set \fB\fCrofi.color\-enabled\fR to true. The new setup allows you to specify
|
||||
colors per state, similar to \fBi3\fP
|
||||
Currently 3 states exists:
|
||||
.RS
|
||||
.IP \(bu 2
|
||||
|
@ -666,7 +667,7 @@ An example for \fB\fCXresources\fR file:
|
|||
.PP
|
||||
.RS
|
||||
.nf
|
||||
! State: 'bg', 'fg', 'bgalt', 'hlfg', 'hlbg'
|
||||
! State: 'bg', 'fg', 'bgalt', 'hlbg', 'hlfg'
|
||||
rofi.color\-normal: #fdf6e3, #002b36, #eee8d5, #586e75, #eee8d5
|
||||
rofi.color\-urgent: #fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3
|
||||
rofi.color\-active: #fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3
|
||||
|
|
|
@ -154,6 +154,7 @@ typedef struct _Settings
|
|||
char * menu_font;
|
||||
|
||||
/** New row colors */
|
||||
unsigned int color_enabled;
|
||||
char * color_normal;
|
||||
char * color_active;
|
||||
char * color_urgent;
|
||||
|
|
|
@ -621,7 +621,6 @@ static void parse_color ( Visual *visual, Colormap colormap,
|
|||
XftColorAllocName ( display, visual, colormap, bg, color );
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
static void textbox_parse_string ( XVisualInfo *visual, Colormap colormap, const char *str, RowColor *color )
|
||||
{
|
||||
if ( str == NULL ) {
|
||||
|
@ -654,37 +653,38 @@ static void textbox_parse_string ( XVisualInfo *visual, Colormap colormap, const
|
|||
}
|
||||
g_free ( cstr );
|
||||
}
|
||||
#endif
|
||||
void textbox_setup ( XVisualInfo *visual, Colormap colormap )
|
||||
{
|
||||
visual_info = visual;
|
||||
target_colormap = colormap;
|
||||
|
||||
textbox_parse_string ( visual, target_colormap,
|
||||
config.color_normal, &( colors[NORMAL] ) );
|
||||
textbox_parse_string ( visual, target_colormap,
|
||||
config.color_urgent, &( colors[URGENT] ) );
|
||||
textbox_parse_string ( visual, target_colormap,
|
||||
config.color_active, &( colors[ACTIVE] ) );
|
||||
#if 1
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg, &( colors[NORMAL].bg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_fg, &( colors[NORMAL].fg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_alt, &( colors[NORMAL].bgalt ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlfg, &( colors[NORMAL].hlfg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlbg, &( colors[NORMAL].hlbg ) );
|
||||
if ( config.color_enabled ) {
|
||||
textbox_parse_string ( visual, target_colormap,
|
||||
config.color_normal, &( colors[NORMAL] ) );
|
||||
textbox_parse_string ( visual, target_colormap,
|
||||
config.color_urgent, &( colors[URGENT] ) );
|
||||
textbox_parse_string ( visual, target_colormap,
|
||||
config.color_active, &( colors[ACTIVE] ) );
|
||||
}
|
||||
else {
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg, &( colors[NORMAL].bg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_fg, &( colors[NORMAL].fg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_alt, &( colors[NORMAL].bgalt ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlfg, &( colors[NORMAL].hlfg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlbg, &( colors[NORMAL].hlbg ) );
|
||||
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_urgent, &( colors[URGENT].bg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_fg_urgent, &( colors[URGENT].fg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_alt, &( colors[URGENT].bgalt ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlfg_urgent, &( colors[URGENT].hlfg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlbg_urgent, &( colors[URGENT].hlbg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_urgent, &( colors[URGENT].bg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_fg_urgent, &( colors[URGENT].fg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_alt, &( colors[URGENT].bgalt ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlfg_urgent, &( colors[URGENT].hlfg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlbg_urgent, &( colors[URGENT].hlbg ) );
|
||||
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_active, &( colors[ACTIVE].bg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_fg_active, &( colors[ACTIVE].fg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_alt, &( colors[ACTIVE].bgalt ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlfg_active, &( colors[ACTIVE].hlfg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlbg_active, &( colors[ACTIVE].hlbg ) );
|
||||
#endif
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_active, &( colors[ACTIVE].bg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_fg_active, &( colors[ACTIVE].fg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_bg_alt, &( colors[ACTIVE].bgalt ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlfg_active, &( colors[ACTIVE].hlfg ) );
|
||||
parse_color ( visual_info->visual, target_colormap, config.menu_hlbg_active, &( colors[ACTIVE].hlbg ) );
|
||||
}
|
||||
PangoFontMap *font_map = pango_xft_get_font_map ( display, DefaultScreen ( display ) );
|
||||
p_context = pango_font_map_create_context ( font_map );
|
||||
}
|
||||
|
|
|
@ -447,30 +447,34 @@ unsigned int color_get ( Display *display, const char *const name )
|
|||
|
||||
unsigned int color_background ( Display *display )
|
||||
{
|
||||
if ( config.menu_bg ) {
|
||||
if ( !config.color_enabled ) {
|
||||
return color_get ( display, config.menu_bg );
|
||||
}
|
||||
unsigned int retv = 0;
|
||||
else {
|
||||
unsigned int retv = 0;
|
||||
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 2 );
|
||||
if ( vals != NULL && vals[0] != NULL ) {
|
||||
retv = color_get ( display, vals[0] );
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 2 );
|
||||
if ( vals != NULL && vals[0] != NULL ) {
|
||||
retv = color_get ( display, vals[0] );
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
return retv;
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
return retv;
|
||||
}
|
||||
|
||||
unsigned int color_border ( Display *display )
|
||||
{
|
||||
if ( config.menu_bc ) {
|
||||
if ( !config.color_enabled ) {
|
||||
return color_get ( display, config.menu_bc );
|
||||
}
|
||||
unsigned int retv = 0;
|
||||
else {
|
||||
unsigned int retv = 0;
|
||||
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 2 );
|
||||
if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
|
||||
retv = color_get ( display, vals[1] );
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 2 );
|
||||
if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
|
||||
retv = color_get ( display, vals[1] );
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
return retv;
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
return retv;
|
||||
}
|
||||
|
|
|
@ -64,11 +64,12 @@ static XrmOption xrmOptions[] = {
|
|||
|
||||
{ xrm_String, "font", { .str = &config.menu_font }, NULL },
|
||||
/* Foreground color */
|
||||
/* { xrm_String, "foreground", { .str = &config.menu_fg }, NULL },*/
|
||||
{ xrm_String, "foreground", { .str = &config.menu_fg }, NULL },
|
||||
{ xrm_String, "fg", { .str = &config.menu_fg }, NULL },
|
||||
/* { xrm_String, "background", { .str = &config.menu_bg }, NULL },*/
|
||||
{ xrm_String, "background", { .str = &config.menu_bg }, NULL },
|
||||
{ xrm_String, "bg", { .str = &config.menu_bg }, NULL },
|
||||
|
||||
{ xrm_Boolean, "color-enabled", { .num = &config.color_enabled }, NULL },
|
||||
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL },
|
||||
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL },
|
||||
{ xrm_String, "color-active", { .str = &config.color_active }, NULL },
|
||||
|
|
Loading…
Reference in a new issue