summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2015-08-26 18:11:53 +0200
committerDave Davenport <qball@gmpclient.org>2015-08-26 18:11:53 +0200
commitd9a9d2489adb3cbaf47d9c7696df956af30afe38 (patch)
tree01e70315d5de17825c9cdd22e356c503e11f3579
parentd6762328468dce28c925f24cf543cd18bfd141b1 (diff)
Add separator color and style option.
-rw-r--r--config/config.def.c7
-rw-r--r--doc/rofi-manpage.markdown10
-rw-r--r--doc/rofi.119
-rw-r--r--include/rofi.h2
-rw-r--r--include/x11-helper.h1
-rw-r--r--source/dialogs/window.c2
-rw-r--r--source/rofi.c11
-rw-r--r--source/x11-helper.c24
-rw-r--r--source/xrmoptions.c3
9 files changed, 66 insertions, 13 deletions
diff --git a/config/config.def.c b/config/config.def.c
index 2a2313b5..7a88c01a 100644
--- a/config/config.def.c
+++ b/config/config.def.c
@@ -131,8 +131,9 @@ Settings config = {
/** Fuzzy matching. */
.fuzzy = FALSE,
/** Monitor */
- .monitor = -1,
- .line_margin = 3,
- .filter = NULL,
+ .monitor = -1,
+ .line_margin = 3,
+ .filter = NULL,
+ .separator_style = "dash",
};
diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown
index e34017d6..ea9dc70c 100644
--- a/doc/rofi-manpage.markdown
+++ b/doc/rofi-manpage.markdown
@@ -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`
diff --git a/doc/rofi.1 b/doc/rofi.1
index acdb5b76..62156bad 100644
--- a/doc/rofi.1
+++ b/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
.
diff --git a/include/rofi.h b/include/rofi.h
index 1aa5b6b9..adad43e8 100644
--- a/include/rofi.h
+++ b/include/rofi.h
@@ -234,6 +234,8 @@ typedef struct _Settings
unsigned int line_margin;
/** filter */
char *filter;
+ /** style */
+ char *separator_style;
} Settings;
/** Global Settings structure. */
diff --git a/include/x11-helper.h b/include/x11-helper.h
index d0597d15..540f6787 100644
--- a/include/x11-helper.h
+++ b/include/x11-helper.h
@@ -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
diff --git a/source/dialogs/window.c b/source/dialogs/window.c
index 7200ed0c..bf078c14 100644
--- a/source/dialogs/window.c
+++ b/source/dialogs/window.c
@@ -442,7 +442,7 @@ static char ** window_mode_get_data ( unsigned int *length, Switcher *sw )
if ( !pd->config_i3_mode ) {
// find client's desktop.
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;
}
diff --git a/source/rofi.c b/source/rofi.c
index 8981bb05..c94be6f8 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -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;
diff --git a/source/x11-helper.c b/source/x11-helper.c
index 5bd1c675..d8b9ec2f 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -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;
+ }
+}
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index a35cf849..657c8ad4 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -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.