[Doc] Update theme manpage with import.

This commit is contained in:
Dave Davenport 2019-12-29 17:30:53 +01:00
parent 0a4426af29
commit afda9cbb13
3 changed files with 88 additions and 1 deletions

View File

@ -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

View File

@ -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.

View File

@ -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;