mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Add separator color and style option.
This commit is contained in:
parent
d676232846
commit
d9a9d2489a
9 changed files with 66 additions and 13 deletions
|
@ -134,5 +134,6 @@ Settings config = {
|
|||
.monitor = -1,
|
||||
.line_margin = 3,
|
||||
.filter = NULL,
|
||||
.separator_style = "dash",
|
||||
};
|
||||
|
||||
|
|
|
@ -311,9 +311,9 @@ The following options are further explained in the theming section:
|
|||
|
||||
Enable the exteneded coloring options.
|
||||
|
||||
`-color-window` *background* *border color*
|
||||
`-color-window` *background* *border color* *separator color */
|
||||
|
||||
Set window background and border color.
|
||||
Set window background, border and separator color.
|
||||
|
||||
`-color-normal` *background, foreground, background alt, highlight background, highlight foreground*
|
||||
|
||||
|
@ -331,6 +331,12 @@ The following options are further explained in the theming section:
|
|||
Min: *3*
|
||||
Max: *50*
|
||||
|
||||
`-separator-style` *style*
|
||||
|
||||
Set the separator style, either "solid" or "dash"
|
||||
|
||||
Default: *dash*
|
||||
|
||||
### Layout
|
||||
|
||||
`-lines`
|
||||
|
|
19
doc/rofi.1
19
doc/rofi.1
|
@ -541,13 +541,13 @@ Enable the exteneded coloring options\.
|
|||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
\fB\-color\-window\fR \fIbackground\fR \fIborder color\fR
|
||||
\fB\-color\-window\fR \fIbackground\fR \fIborder color\fR \fIseparator color\fR/
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
Set window background and border color\.
|
||||
Set window background, border and separator color\.
|
||||
.
|
||||
.fi
|
||||
.
|
||||
|
@ -589,6 +589,21 @@ Max: *50*
|
|||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.P
|
||||
\fB\-separator\-style\fR \fIstyle\fR
|
||||
.
|
||||
.IP "" 4
|
||||
.
|
||||
.nf
|
||||
|
||||
Set the separator style, either "solid" or "dash"
|
||||
|
||||
Default: *dash*
|
||||
.
|
||||
.fi
|
||||
.
|
||||
.IP "" 0
|
||||
.
|
||||
.SS "Layout"
|
||||
\fB\-lines\fR
|
||||
.
|
||||
|
|
|
@ -234,6 +234,8 @@ typedef struct _Settings
|
|||
unsigned int line_margin;
|
||||
/** filter */
|
||||
char *filter;
|
||||
/** style */
|
||||
char *separator_style;
|
||||
} Settings;
|
||||
|
||||
/** Global Settings structure. */
|
||||
|
|
|
@ -148,4 +148,5 @@ unsigned int color_get ( Display *display, const char *const name, const char *
|
|||
|
||||
unsigned int color_background ( Display *display );
|
||||
unsigned int color_border ( Display *display );
|
||||
unsigned int color_separator ( Display *display );
|
||||
#endif
|
||||
|
|
|
@ -251,8 +251,15 @@ static Window create_window ( Display *display )
|
|||
XSelectInput ( display, box, ExposureMask | ButtonPressMask );
|
||||
|
||||
gc = XCreateGC ( display, box, 0, 0 );
|
||||
XSetLineAttributes ( display, gc, 2, LineOnOffDash, CapButt, JoinMiter );
|
||||
XSetForeground ( display, gc, color_border ( display ) );
|
||||
int line_style = LineOnOffDash;
|
||||
if ( strcasecmp ( config.separator_style, "dash" ) == 0 ) {
|
||||
line_style = LineOnOffDash;
|
||||
}
|
||||
else if ( strcasecmp ( config.separator_style, "solid" ) == 0 ) {
|
||||
line_style = LineSolid;
|
||||
}
|
||||
XSetLineAttributes ( display, gc, 2, line_style, CapButt, JoinMiter );
|
||||
XSetForeground ( display, gc, color_separator ( display ) );
|
||||
// make it an unmanaged window
|
||||
window_set_atom_prop ( display, box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1 );
|
||||
XSetWindowAttributes sattr;
|
||||
|
|
|
@ -537,7 +537,7 @@ unsigned int color_background ( Display *display )
|
|||
else {
|
||||
unsigned int retv = 0;
|
||||
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 2 );
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
||||
if ( vals != NULL && vals[0] != NULL ) {
|
||||
retv = color_get ( display, g_strstrip ( vals[0] ), "black" );
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ unsigned int color_border ( Display *display )
|
|||
else {
|
||||
unsigned int retv = 0;
|
||||
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 2 );
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
||||
if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
|
||||
retv = color_get ( display, vals[1], "white" );
|
||||
}
|
||||
|
@ -562,3 +562,23 @@ unsigned int color_border ( Display *display )
|
|||
return retv;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int color_separator ( Display *display )
|
||||
{
|
||||
if ( !config.color_enabled ) {
|
||||
return color_get ( display, config.menu_bc, "white" );
|
||||
}
|
||||
else {
|
||||
unsigned int retv = 0;
|
||||
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
||||
if ( vals != NULL && vals[0] != NULL && vals[1] != NULL && vals[2] != NULL ) {
|
||||
retv = color_get ( display, vals[2], "white" );
|
||||
}
|
||||
else if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
|
||||
retv = color_get ( display, vals[1], "white" );
|
||||
}
|
||||
g_strfreev ( vals );
|
||||
return retv;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,8 @@ static XrmOption xrmOptions[] = {
|
|||
/* Alias for dmenu compatibility. */
|
||||
{ xrm_SNumber, "m", { .snum = &config.monitor }, NULL },
|
||||
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL },
|
||||
{ xrm_String, "filter", { .str = &config.filter }, NULL }
|
||||
{ xrm_String, "filter", { .str = &config.filter }, NULL },
|
||||
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL }
|
||||
};
|
||||
|
||||
// Dynamic options.
|
||||
|
|
Loading…
Reference in a new issue