The need for a new theme format was motivated by the fact that the way rofi handled widgets has changed\. From a very static drawing of lines and text to a nice structured form of packing widgets\. This change made it possible to provide a more flexible theme framework\. The old theme format and config file are not flexible enough to expose these options in a user\-friendly way\. Therefor, a new file format has been created, replacing the old one\.
.
.SH"FORMAT SPECIFICATION"
.
.SH"Encoding"
The encoding of the file is utf\-8\. Both unix (\fB\en\fR) and windows (\fB\er\en\fR) newlines format are supported\. But unix is preferred\.
.
.SH"Comments"
C and C++ file comments are supported\.
.
.IP"\(bu"4
Anything after \fB//\fR and before a newline is considered a comment\.
.
.IP"\(bu"4
Everything between \fB/*\fR and \fB*/\fR is a comment\.
.
.IP""0
.
.P
Comments can be nested and the C comments can be inline\.
The preferred file extension for the new theme format is \fBrasi\fR\. This is an abbreviation for \fBr\fRofi \fBa\fRdvanced \fBs\fRtyle \fBi\fRnformation\.
.
.SH"Basic Structure"
Each element has a section with defined properties\. Global properties can be defined in section \fB* { }\fR\. Sub\-section names begin with a hash symbol \fB#\fR\.
.
.P
It is advised to define the \fIglobal properties section\fR on top of the file to make inheritance of properties clearer\.
If there are multiple sections with the same name, they are merged\. Duplicate properties are overwritten and the last parsed entry kept\.
.
.SH"Global properties section"
A theme can have one or more global properties sections\. If there is more than one, they will be merged\.
.
.P
The global properties section denotes the defaults for each element\. Each property of this section can be referenced with \fB@{identifier}\fR (See Properties section)
.
.P
A global properties section is indicated with a \fB*\fR as element path\.
.
.SH"Element theme section"
A theme can have multiple element theme sections\.
.
.P
The element path can consist of multiple names separated by whitespace or dots\. Each element may contain any number of letters, numbers and \fB\-\fR\'s\. The first element in the element path should always start with a \fB#\fR\. Multiple elements can be specified by a \fB,\fR\.
Each section inherits the global properties\. Properties can be explicitly inherited from their parent with the \fBinherit\fR keyword\. In the following example:
If multiple sections are defined with the same name, they are merged by the parser\. If multiple properties with the same name are defined in one section, the last encountered property is used\.
The \fBidentifier\fR names the specified property\. Identifiers can consist of any combination of numbers, letters and \'\-\'\. It must not contain any whitespace\. The structure of the \fBvalue\fR defines the type of the property\. The current parser does not define or enforce a certain type of a particular \fBidentifier\fR\. When used, values with the wrong type that cannot be converted are ignored\.
\fB{HEX}\fR is a hexadecimal number (\'0\-9a\-f\' case insensitive)\.
.
.IP"\(bu"4
\fB{INTEGER}\fR value can be between 0 and 255 or 0\-100 when representing percentage\.
.
.IP"\(bu"4
\fB{ANGLE}\fR is the angle on the color wheel, can be in \fBdeg\fR, \fBrad\fR, \fBgrad\fR or \fBturn\fR\. When no unit is specified, degrees is assumed\.
.
.IP"\(bu"4
\fB{PERCENTAGE}\fR can be between 0\-1\.0, or 0%\-100%
.
.IP"\(bu"4
\fB{named\-color}\fR is one of the following colors:
Text style indicates how the highlighted text is emphasized\.\fBNone\fR indicates that no emphasis should be applied\.
.
.IP"\(bu"4
\fBbold\fR: make the text thicker then the surrounding text\.
.
.IP"\(bu"4
\fBitalic\fR: put the highlighted text in script type (slanted)\.
.
.IP"\(bu"4
\fBunderline\fR: put a line under the highlighted text\.
.
.IP"\(bu"4
\fBstrikethrough\fR: put a line through the highlighted text\.
.
.IP"\(bu"4
\fBsmall caps\fR: emphasise the text using capitalization\.
.
.IP""0
.
.SH"Line style"
.
.IP"\(bu"4
Format: \fB(dash|solid)\fR
.
.IP""0
.
.P
Indicates how a line should be drawn\. It currently supports: * \fBdash\fR: a dashed line, where the gap is the same width as the dash * \fBsolid\fR: a solid line
A reference can point to another reference\. Currently, the maximum number of redirects is 20\. A property always refers to another property\. It cannot be used for a subpart of the property\. For example, this is not valid:
A list starts with a \'[\' and ends with a \']\'\. The entries in the list are comma\-separated\. The \fBkeyword\fR in the list refers to an widget name\.
.
.SH"Environment variable"
.
.IP"\(bu"4
Format: \fB${:alnum:}\fR
.
.IP""0
.
.P
This will parse the environment variable as the property value\. (that then can be any of the above types)\. The environment variable should be an alphanumeric string without white\-space\.
Where \fBvisible modifier\fR can be: * normal: no modification * selected: the entry is selected/highlighted by user * alternate: the entry is at an alternating row (uneven row)
.
.P
Where \fBstate\fR is: * normal: no modification * urgent: this entry is marked urgent * active: this entry is marked active
Sets all selected textboxes marked active to the given text and background color\. Note that a state modifies the original element, it therefore contains all the properties of that element\.
.
.SS"Scrollbar"
The scrollbar uses the \fBhandle\fR state when drawing the small scrollbar handle\. This allows the colors used for drawing the handle to be set independently\.
\fBpadding\fR: padding Padding on the inside of the widget
.
.IP"\(bu"4
\fBmargin\fR: padding Margin on the outside of the widget
.
.IP"\(bu"4
\fBborder\fR: border Border around the widget (between padding and margin)/
.
.IP"\(bu"4
\fBborder\-radius\fR: padding Sets a radius on the corners of the borders\.
.
.IP"\(bu"4
\fBbackground\-color\fR: color Background color
.
.IP"\(bu"4
\fBborder\-color\fR: color Color of the border
.
.IP""0
.
.SS"window:"
.
.IP"\(bu"4
\fBfont\fR: string The font used in the window
.
.IP"\(bu"4
\fBtransparency\fR: string Indicating if transparency should be used and what type: \fBreal\fR\- True transparency\. Only works with a compositor\.\fBbackground\fR\- Take a screenshot of the background image and use that\.\fBscreenshot\fR\- Take a screenshot of the screen and use that\.\fBPath\fR to png file \- Use an image\.
.
.IP"\(bu"4
\fBlocation\fR: position The place of the anchor on the monitor
.
.IP"\(bu"4
\fBanchor\fR: anchor The anchor position on the window
.
.IP"\(bu"4
\fBfullscreen\fR: boolean Window is fullscreen\.
.
.IP"\(bu"4
\fBwidth\fR: distance The width of the window
.
.IP"\(bu"4
\fBx\-offset\fR: distance
.
.IP"\(bu"4
\fBy\-offset\fR: distance The offset of the window to the anchor point, allowing you to push the window left/right/up/down
.
.IP""0
.
.SS"scrollbar:"
.
.IP"\(bu"4
\fBbackground\-color\fR: color
.
.IP"\(bu"4
\fBhandle\-width\fR: distance
.
.IP"\(bu"4
\fBhandle\-color\fR: color
.
.IP"\(bu"4
\fBborder\-color\fR: color
.
.IP""0
.
.SS"box:"
.
.IP"\(bu"4
\fBorientation\fR: orientation Set the direction the elements are packed\.
.
.IP"\(bu"4
\fBspacing\fR: distance Distance between the packed elements\.
.
.IP""0
.
.SS"textbox:"
.
.IP"\(bu"4
\fBbackground\-color\fR: color
.
.IP"\(bu"4
\fBborder\-color\fR: the color used for the border around the widget\.
.
.IP"\(bu"4
\fBfont\fR: the font used by this textbox (string)\.
.
.IP"\(bu"4
\fBstr\fR: the string to display by this textbox (string)\.
.
.IP"\(bu"4
\fBvertical\-align\fR: vertical alignment of the text (\fB0\fR top, \fB1\fR bottom)\.
.
.IP"\(bu"4
\fBhorizontal\-align\fR: horizontal alignment of the text (\fB0\fR left, \fB1\fR right)\.
.
.IP"\(bu"4
\fBtext\-color\fR: the text color to use\.
.
.IP"\(bu"4
\fBhighlight\fR: text style {color}\. color is optional, multiple highlight styles can be added like: bold underline italic #000000;
.
.IP"\(bu"4
\fBwidth\fR: override the desired width for the textbox\.
.
.IP"\(bu"4
\fBcontent\fR: Set the displayed text (String)\.
.
.IP"\(bu"4
\fBplaceholder\fR: Set the displayed text (String) when nothing is entered\.
.
.IP"\(bu"4
\fBplaceholder\-color\fR: Color of the placeholder text\.
.
.IP"\(bu"4
\fBblink\fR: Enable/Disable blinking on an input textbox (Boolean)\.
.
.IP""0
.
.SS"listview:"
.
.IP"\(bu"4
\fBcolumns\fR: integer Number of columns to show (at least 1)
.
.IP"\(bu"4
\fBfixed\-height\fR: boolean Always show \fBlines\fR rows, even if fewer elements are available\.
.
.IP"\(bu"4
\fBdynamic\fR: boolean \fBTrue\fR if the size should change when filtering the list, \fBFalse\fR if it should keep the original height\.
.
.IP"\(bu"4
\fBscrollbar\fR: boolean If the scrollbar should be enabled/disabled\.
.
.IP"\(bu"4
\fBscrollbar\-width\fR: distance Width of the scrollbar
.
.IP"\(bu"4
\fBcycle\fR: boolean When navigating, it should wrap around
.
.IP"\(bu"4
\fBspacing\fR: distance Spacing between the elements (both vertical and horizontal)
.
.IP"\(bu"4
\fBlines\fR: integer Number of rows to show in the list view\.
.
.IP"\(bu"4
\fBlayout\fR: orientation Indicate how elements are stacked\. Horizontal implements the dmenu style\.
.
.IP"\(bu"4
\fBreverse\fR: boolean Reverse the ordering (top down to bottom up)\.
.
.IP"\(bu"4
\fBfixed\-columns\fR: boolean Do not reduce the number of columns shown when number of visible elements is not enough to fill them all\.
.
.IP""0
.
.P
Each element is a \fBbox\fR called \fBelement\fR\. Each \fBelement\fR can contain an \fBelement\-icon\fR and \fBelement\-text\fR\.
.
.SH"Layout"
The new format allows the layout of the \fBrofi\fR window to be tweaked extensively\. For each widget, the themer can specify padding, margin, border, font, and more\. It even allows, as an advanced feature, to pack widgets in a custom structure\.
.
.SS"Basic structure"
The whole view is made out of boxes that pack other boxes or widgets\. The box can be vertical or horizontal\. This is loosely inspired by GTK \fIhttp://gtk\.org/\fR\.
.
.P
The current layout of \fBrofi\fR is structured as follows:
The following keywords are defined and can be used to automatically pack a subset of the widgets\. These are used in the default theme as depicted in the figure above\.
This is a textbox widget\. The displayed string can be set with \fBstr\fR\.
.
.TP
\fBicon\fR
This is an icon widget\. The displayed icon can be set with \fBfilename\fR and size with \fBsize\fR\.
.
.TP
\fBbutton\fR
This is a textbox widget that can have a \'clickable\' action\. The \fBaction\fR can be set to: \fBok\fR accept entry\.\fBcustom\fR accept custom input\.\fBok|alternate\fR: accept entry and launch alternate action (for run launch in terminal)\.\fBcustom|alternate\fR: accept custom input and launch alternate action\.
.
.P
To specify children, set the \fBchildren\fR property (this always happens on the \fBbox\fR child, see example below):
Padding \- Clears an area around the widget\. The padding shows the background color of the widget\.
.
.IP"\(bu"4
Border \- A border that goes around the padding and content\. The border use the border\-color of the widget\.
.
.IP"\(bu"4
Margin \- Clears an area outside the border\. The margin is transparent\.
.
.IP""0
.
.P
The box model allows us to add a border around elements, and to define space between elements\.
.
.P
The size of each margin, border, and padding can be set\. For the border, a linestyle and radius can be set\.
.
.SS"Spacing"
Widgets that can pack more then one child widget (currently box and listview) have the \fBspacing\fR property\. This property sets the distance between the packed widgets (both horizontally and vertically)\.
If both dummy widgets are set to expand, \fBchild\fR will be centered\. Depending on the \fBexpand\fR flag of child the remaining space will be equally divided between both dummy and child widget (expand enabled), or both dummy widgets (expand disabled)\.
\fBmin\-width\fR: load when width is bigger then value\.
.
.IP"\(bu"4
\fBmax\-width\fR: load when width is smaller then value\.
.
.IP"\(bu"4
\fBmin\-height\fR: load when height is bigger then value\.
.
.IP"\(bu"4
\fBmax\-height\fR: load when height is smaller then value\.
.
.IP"\(bu"4
\fBmin\-aspect\-ratio\fR load when aspect ratio is over value\.
.
.IP"\(bu"4
\fBmax\-aspect_ratio\fR: load when aspect ratio is under value\.
.
.IP"\(bu"4
\fBmonitor\-id\fR: The monitor id, see rofi \-help for id\'s\.
.
.IP""0
.
.SH"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\.
.
.IP"\(bu"4
import: Import and parse a second file\.
.
.IP"\(bu"4
theme: Discard theme, and load file as a fresh theme\.
A name is resolved as a filename by appending the \fB\.rasi\fR extension\.
.
.SH"EXAMPLES"
Several examples are installed together with \fBrofi\fR\. These can be found in \fB{datadir}/rofi/themes/\fR, where \fB{datadir}\fR is the install path of \fBrofi\fR data\. When installed using a package manager, this is usually: \fB/usr/share/\fR\.