diff options
author | Dave Davenport <qball@gmpclient.org> | 2019-12-29 17:30:53 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2019-12-29 17:30:53 +0100 |
commit | afda9cbb13c34d04cf2f32d24cc4fda00b8fb292 (patch) | |
tree | 2b04c7719fb0fd34a2d566c1916fe74f96059343 | |
parent | 0a4426af294dfdc22cd58ad27157b19894656476 (diff) |
[Doc] Update theme manpage with import.
-rw-r--r-- | doc/rofi-theme.5 | 47 | ||||
-rw-r--r-- | doc/rofi-theme.5.markdown | 25 | ||||
-rw-r--r-- | source/widgets/listview.c | 17 |
3 files changed, 88 insertions, 1 deletions
diff --git a/doc/rofi-theme.5 b/doc/rofi-theme.5 index 55f585cf..0a9229dc 100644 --- a/doc/rofi-theme.5 +++ b/doc/rofi-theme.5 @@ -1511,6 +1511,53 @@ It supports the following keys as constraint: .RE +.SH Multiple file handling +.PP +The rasi file format offers two methods of including other files. +This can be used to modify existing themes, or have multiple variations on a theme. + +.RS +.IP \(bu 2 +import: Import and parse a second file. +.IP \(bu 2 +theme: Discard theme, and load file as a fresh theme. + +.RE + +.PP +Syntax: + +.PP +.RS + +.nf +@import "myfile" +@theme "mytheme" + +.fi +.RE + +.PP +The specified file can either by \fIname\fP, \fIfilename\fP,\fIfull path\fP\&. + +.PP +If a filename is provided, it will try to resolve it in the following order: + +.RS +.IP \(bu 2 +\fB\fC${XDG\_CONFIG\_HOME}/rofi/themes/\fR +.IP \(bu 2 +\fB\fC${XDG\_CONFIG\_HOME}/rofi/\fR +.IP \(bu 2 +\fB\fC${XDG\_DATA\_HOME}/rofi/themes/\fR +.IP \(bu 2 +\fB\fC${INSTALL PREFIX}/share/rofi/themes/\fR + +.RE + +.PP +A name is resolved as a filename by appending the \fB\fC\&.rasi\fR extension. + .SH EXAMPLES .PP Several examples are installed together with \fBrofi\fP\&. These can be found in \fB\fC{datadir}/rofi/themes/\fR, where diff --git a/doc/rofi-theme.5.markdown b/doc/rofi-theme.5.markdown index c1f05e20..7512c11a 100644 --- a/doc/rofi-theme.5.markdown +++ b/doc/rofi-theme.5.markdown @@ -956,6 +956,31 @@ It supports the following keys as constraint: * `monitor-id`: The monitor id, see rofi -help for id's. +## Multiple file handling + +The rasi file format offers two methods of including other files. +This can be used to modify existing themes, or have multiple variations on a theme. + + * import: Import and parse a second file. + * theme: Discard theme, and load file as a fresh theme. + +Syntax: + +``` +@import "myfile" +@theme "mytheme" +``` + +The specified file can either by *name*, *filename*,*full path*. + +If a filename is provided, it will try to resolve it in the following order: + + * `${XDG_CONFIG_HOME}/rofi/themes/` + * `${XDG_CONFIG_HOME}/rofi/` + * `${XDG_DATA_HOME}/rofi/themes/` + * `${INSTALL PREFIX}/share/rofi/themes/` + +A name is resolved as a filename by appending the `.rasi` extension. diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 88007013..f71a284d 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -404,8 +404,22 @@ static void listview_draw ( widget *wid, cairo_t *draw ) width -= widget_get_width ( WIDGET ( lv->scrollbar ) ); } unsigned int element_width = ( width ) / lv->cur_columns; + + int d = lv->widget.w - (element_width+spacing_hori)*(lv->cur_columns-1)-element_width; + if ( lv->cur_columns > 1) + { + int diff = d/(lv->cur_columns-1); + if ( diff >= 1 ){ + spacing_hori+=1; + d -= lv->cur_columns-1; + } + } for ( unsigned int i = 0; i < max; i++ ) { unsigned int ex = left_offset + ( ( i ) / lv->max_rows ) * ( element_width + spacing_hori ); + + if ( (i)/lv->max_rows == (lv->cur_columns-1) ) { + ex+=d; + } if ( lv->reverse ) { unsigned int ey = wid->h - ( widget_padding_get_bottom ( wid ) + ( ( i ) % lv->max_rows ) * ( lv->element_height + spacing_vert ) ) - lv->element_height; widget_move ( WIDGET(lv->boxes[i].box), ex, ey); @@ -421,6 +435,7 @@ static void listview_draw ( widget *wid, cairo_t *draw ) widget_draw ( WIDGET ( lv->boxes[i].box ), draw ); } lv->rchanged = FALSE; + } else { for ( unsigned int i = 0; i < max; i++ ) { @@ -926,7 +941,7 @@ void listview_toggle_ellipsizing ( listview *lv ) { if ( lv ) { PangoEllipsizeMode mode = lv->emode; - if ( mode == PANGO_ELLIPSIZE_START ) { + if ( mode == PANGO_ELLIPSIZE_START ) { mode = PANGO_ELLIPSIZE_MIDDLE; } else if ( mode == PANGO_ELLIPSIZE_MIDDLE ) { mode = PANGO_ELLIPSIZE_END; |