1
0
Fork 0
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:
Dave Davenport 2015-08-26 18:11:53 +02:00
parent d676232846
commit d9a9d2489a
9 changed files with 66 additions and 13 deletions

View file

@ -131,8 +131,9 @@ Settings config = {
/** Fuzzy matching. */ /** Fuzzy matching. */
.fuzzy = FALSE, .fuzzy = FALSE,
/** Monitor */ /** Monitor */
.monitor = -1, .monitor = -1,
.line_margin = 3, .line_margin = 3,
.filter = NULL, .filter = NULL,
.separator_style = "dash",
}; };

View file

@ -311,9 +311,9 @@ The following options are further explained in the theming section:
Enable the exteneded coloring options. 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* `-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* Min: *3*
Max: *50* Max: *50*
`-separator-style` *style*
Set the separator style, either "solid" or "dash"
Default: *dash*
### Layout ### Layout
`-lines` `-lines`

View file

@ -541,13 +541,13 @@ Enable the exteneded coloring options\.
.IP "" 0 .IP "" 0
. .
.P .P
\fB\-color\-window\fR \fIbackground\fR \fIborder color\fR \fB\-color\-window\fR \fIbackground\fR \fIborder color\fR \fIseparator color\fR/
. .
.IP "" 4 .IP "" 4
. .
.nf .nf
Set window background and border color\. Set window background, border and separator color\.
. .
.fi .fi
. .
@ -589,6 +589,21 @@ Max: *50*
. .
.IP "" 0 .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" .SS "Layout"
\fB\-lines\fR \fB\-lines\fR
. .

View file

@ -234,6 +234,8 @@ typedef struct _Settings
unsigned int line_margin; unsigned int line_margin;
/** filter */ /** filter */
char *filter; char *filter;
/** style */
char *separator_style;
} Settings; } Settings;
/** Global Settings structure. */ /** Global Settings structure. */

View file

@ -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_background ( Display *display );
unsigned int color_border ( Display *display ); unsigned int color_border ( Display *display );
unsigned int color_separator ( Display *display );
#endif #endif

View file

@ -442,7 +442,7 @@ static char ** window_mode_get_data ( unsigned int *length, Switcher *sw )
if ( !pd->config_i3_mode ) { if ( !pd->config_i3_mode ) {
// find client's desktop. // find client's desktop.
if ( !window_get_cardinal_prop ( display, c->window, netatoms[_NET_WM_DESKTOP], &wmdesktop, 1 ) ) { if ( !window_get_cardinal_prop ( display, c->window, netatoms[_NET_WM_DESKTOP], &wmdesktop, 1 ) ) {
// Assume the client is on all desktops. // Assume the client is on all desktops.
wmdesktop = 0xFFFFFFFF; wmdesktop = 0xFFFFFFFF;
} }

View file

@ -251,8 +251,15 @@ static Window create_window ( Display *display )
XSelectInput ( display, box, ExposureMask | ButtonPressMask ); XSelectInput ( display, box, ExposureMask | ButtonPressMask );
gc = XCreateGC ( display, box, 0, 0 ); gc = XCreateGC ( display, box, 0, 0 );
XSetLineAttributes ( display, gc, 2, LineOnOffDash, CapButt, JoinMiter ); int line_style = LineOnOffDash;
XSetForeground ( display, gc, color_border ( display ) ); 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 // make it an unmanaged window
window_set_atom_prop ( display, box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1 ); window_set_atom_prop ( display, box, netatoms[_NET_WM_STATE], &netatoms[_NET_WM_STATE_ABOVE], 1 );
XSetWindowAttributes sattr; XSetWindowAttributes sattr;

View file

@ -537,7 +537,7 @@ unsigned int color_background ( Display *display )
else { else {
unsigned int retv = 0; 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 ) { if ( vals != NULL && vals[0] != NULL ) {
retv = color_get ( display, g_strstrip ( vals[0] ), "black" ); retv = color_get ( display, g_strstrip ( vals[0] ), "black" );
} }
@ -554,7 +554,7 @@ unsigned int color_border ( Display *display )
else { else {
unsigned int retv = 0; 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 ) { if ( vals != NULL && vals[0] != NULL && vals[1] != NULL ) {
retv = color_get ( display, vals[1], "white" ); retv = color_get ( display, vals[1], "white" );
} }
@ -562,3 +562,23 @@ unsigned int color_border ( Display *display )
return retv; 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;
}
}

View file

@ -128,7 +128,8 @@ static XrmOption xrmOptions[] = {
/* Alias for dmenu compatibility. */ /* Alias for dmenu compatibility. */
{ xrm_SNumber, "m", { .snum = &config.monitor }, NULL }, { xrm_SNumber, "m", { .snum = &config.monitor }, NULL },
{ xrm_Number, "line-margin", { .num = &config.line_margin }, 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. // Dynamic options.