1ROFI-THEME(5)                 File Formats Manual                ROFI-THEME(5)
2
3
4

NAME

6       rofi-theme - Rofi theme format files
7
8

DESCRIPTION

10       The  need for a new theme format was motivated by the fact that the way
11       rofi handled widgets has changed. From a very static drawing  of  lines
12       and text to a nice structured form of packing widgets. This change made
13       it possible to provide a more flexible theme framework. The  old  theme
14       format  and config file are not flexible enough to expose these options
15       in a user-friendly way. Therefore, a new file format has been  created,
16       replacing the old one.
17
18

FORMAT SPECIFICATION

Encoding

21       The  encoding  of  the file is utf-8. Both unix (\n) and windows (\r\n)
22       newlines format are supported. But unix is preferred.
23
24

Comments

26       C and C++ file comments are supported.
27
28       · Anything after  // and before a newline is considered a comment.
29
30       · Everything between /* and */ is a comment.
31
32
33       Comments can be nested and the C comments can be inline.
34
35
36       The following is valid:
37
38
39              // Magic comment.
40              property: /* comment */ value;
41
42
43
44       However, this is not:
45
46
47              prop/*comment*/erty: value;
48
49
50

White space

52       White space and newlines, like comments, are ignored by the parser.
53
54
55       This:
56
57
58              property: name;
59
60
61
62       Is identical to:
63
64
65                   property             :
66              name
67
68              ;
69
70
71

File extension

73       The preferred file extension for the new theme format is rasi. This  is
74       an abbreviation for rofi advanced style information.
75
76

Basic Structure

78       Each  element  has a section with defined properties. Global properties
79       can be defined in section * { }.  Sub-section names begin with  a  hash
80       symbol #.
81
82
83       It  is  advised  to  define the global properties section on top of the
84       file to make inheritance of properties clearer.
85
86
87              /* Global properties section */
88              * {
89                  // list of properties
90              }
91
92              /* Element theme section. */
93              {element path} {
94                  // list of properties
95              }
96              {elements... } {
97                  // list of properties
98              }
99
100
101
102       If there are multiple sections with the same  name,  they  are  merged.
103       Duplicate properties are overwritten and the last parsed entry kept.
104
105

Global properties section

107       A  theme  can  have one or more global properties sections. If there is
108       more than one, they will be merged.
109
110
111       The global properties section denotes the defaults  for  each  element.
112       Each property of this section can be referenced with @{identifier} (See
113       Properties section)
114
115
116       A global properties section is indicated with a * as element path.
117
118

Element theme section

120       A theme can have multiple element theme sections.
121
122
123       The element path can consist of multiple names separated by  whitespace
124       or  dots.   Each element may contain any number of letters, numbers and
125       -'s.  The first element in the element path should always start with  a
126       #.  Multiple elements can be specified by a ,.
127
128
129       This is a valid element name:
130
131
132              element normal.normal {
133                  background-color: blue;
134              }
135              button {
136                  background-color: blue;
137              }
138
139
140
141       And is identical to:
142
143
144              element normal normal, button {
145                  background-color: blue;
146              }
147
148
149
150       Each  section inherits the global properties. Properties can be explic‐
151       itly inherited from their parent with the inherit keyword.  In the fol‐
152       lowing example:
153
154
155              window {
156               a: 1;
157               b: 2;
158               children: [ mainbox ];
159              }
160              mainbox {
161                  a: inherit;
162                  b: 4;
163                  c: 8;
164              }
165
166
167
168       The element mainbox will have the following set of properties (if main‐
169       box is a child of window):
170
171
172              a: 1;
173              b: 4;
174              c: 8;
175
176
177
178       If multiple sections are defined with the same name, they are merged by
179       the  parser.  If  multiple properties with the same name are defined in
180       one section, the last encountered property is used.
181
182

Properties Format

184       The properties in a section consist of:
185
186
187              {identifier}: {value};
188
189
190
191       Both fields are mandatory for a property.
192
193
194       The identifier names the specified property. Identifiers can consist of
195       any  combination  of  numbers, letters and '-'. It must not contain any
196       whitespace.  The structure of the value defines the type of  the  prop‐
197       erty. The current parser does not define or enforce a certain type of a
198       particular identifier.  When used, values with the wrong type that can‐
199       not be converted are ignored.
200
201
202       The current theme format supports different types:
203
204       · a string
205
206       · an integer number
207
208       · a fractional number
209
210       · a boolean value
211
212       · a color
213
214       · text style
215
216       · line style
217
218       · a distance
219
220       · a padding
221
222       · a border
223
224       · a position
225
226       · a reference
227
228       · an orientation
229
230       · a list of keywords
231
232       · an environment variable
233
234       · Inherit
235
236
237       Some of these types are a combination of other types.
238
239

String.IP · 2

241       Format:  "[:print:]+"
242
243
244       A  string is always surrounded by double quotes ("). Between the quotes
245       there can be any printable character.
246
247
248       For example:
249
250
251              font: "Awasome 12";
252
253
254
255       The string must be valid UTF-8.
256
257

Integer.IP · 2

259       Format: [-+]?[:digit:]+
260
261
262       An integer may contain any number.
263
264
265       For examples:
266
267
268              lines: 12;
269
270
271

Real.IP · 2

273       Format: [-+]?[:digit:]+(\.[:digit:]+)?
274
275
276       A real is an integer with an optional fraction.
277
278
279       For example:
280
281
282              real: 3.4;
283
284
285
286       The following is not valid: .3, 3. or scientific notation: 3.4e-3.
287
288

Boolean.IP · 2

290       Format: (true|false)
291
292
293       Boolean value is either true or false. This is case-sensitive.
294
295
296       For example:
297
298
299              dynamic: false;
300
301
302

Color

304       rofi supports the color formats as specified in the CSS standard (1,2,3
305       and some of CSS 4)
306
307       · Format: #{HEX}{3} (rgb)
308
309       · Format: #{HEX}{4} (rgba)
310
311       · Format: #{HEX}{6} (rrggbb)
312
313       · Format: #{HEX}{8} (rrggbbaa)
314
315       · Format: rgb[a]({INTEGER},{INTEGER},{INTEGER}[, {PERCENTAGE}])
316
317       · Format: rgb[a]({INTEGER}%,{INTEGER}%,{INTEGER}%[, {PERCENTAGE}])
318
319       · Format: hsl[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [, {PERCENTAGE}])
320
321       · Format: hwb[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [, {PERCENTAGE}])
322
323       · Format:  cmyk( {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE}
324         [, {PERCENTAGE} ])
325
326       · Format: {named-color} [ / {PERCENTAGE} ]
327
328
329       The white-space format proposed in CSS4 is also supported.
330
331
332       The different values are:
333
334       · {HEX} is a hexadecimal number ('0-9a-f' case insensitive).
335
336       · {INTEGER} value can be between 0 and 255 or 0-100  when  representing
337         percentage.
338
339       · {ANGLE}  is the angle on the color wheel, can be in deg, rad, grad or
340         turn. When no unit is specified, degrees is assumed.
341
342       · {PERCENTAGE} can be between 0-1.0, or 0%-100%
343
344       ·
345
346
347       {named-color} is one of the following colors:
348
349       AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, Beige, Bisque, Black,
350       BlanchedAlmond,  Blue,  BlueViolet,  Brown, BurlyWood, CadetBlue, Char‐
351       treuse, Chocolate,  Coral,  CornflowerBlue,  Cornsilk,  Crimson,  Cyan,
352       DarkBlue, DarkCyan, DarkGoldenRod, DarkGray, DarkGrey, DarkGreen, Dark‐
353       Khaki, DarkMagenta, DarkOliveGreen,  DarkOrange,  DarkOrchid,  DarkRed,
354       DarkSalmon,  DarkSeaGreen, DarkSlateBlue, DarkSlateGray, DarkSlateGrey,
355       DarkTurquoise, DarkViolet,  DeepPink,  DeepSkyBlue,  DimGray,  DimGrey,
356       DodgerBlue,  FireBrick,  FloralWhite,  ForestGreen, Fuchsia, Gainsboro,
357       GhostWhite, Gold, GoldenRod, Gray, Grey, Green, GreenYellow,  HoneyDew,
358       HotPink,  IndianRed,  Indigo,  Ivory,  Khaki,  Lavender, LavenderBlush,
359       LawnGreen, LemonChiffon, LightBlue, LightCoral, LightCyan, LightGolden‐
360       RodYellow,  LightGray,  LightGrey,  LightGreen, LightPink, LightSalmon,
361       LightSeaGreen,  LightSkyBlue,  LightSlateGray,  LightSlateGrey,  Light‐
362       SteelBlue, LightYellow, Lime, LimeGreen, Linen, Magenta, Maroon, Mediu‐
363       mAquaMarine, MediumBlue,  MediumOrchid,  MediumPurple,  MediumSeaGreen,
364       MediumSlateBlue,  MediumSpringGreen,  MediumTurquoise, MediumVioletRed,
365       MidnightBlue, MintCream, MistyRose, Moccasin, NavajoWhite,  Navy,  Old‐
366       Lace, Olive, OliveDrab, Orange, OrangeRed, Orchid, PaleGoldenRod, Pale‐
367       Green, PaleTurquoise, PaleVioletRed, PapayaWhip, PeachPuff, Peru, Pink,
368       Plum,  PowderBlue,  Purple,  RebeccaPurple,  Red, RosyBrown, RoyalBlue,
369       SaddleBrown, Salmon, SandyBrown, SeaGreen,  SeaShell,  Sienna,  Silver,
370       SkyBlue, SlateBlue, SlateGray, SlateGrey, Snow, SpringGreen, SteelBlue,
371       Tan,  Teal,  Thistle,  Tomato,   Turquoise,   Violet,   Wheat,   White,
372       WhiteSmoke, Yellow, YellowGreen,transparent
373
374
375       For example:
376
377
378              background-color: #FF0000;
379              border-color: rgba(0,0,1, 0.5);
380              text-color: SeaGreen;
381
382
383
384       or
385
386
387              background-color: transparent;
388              text-color: Black;
389
390
391

Text style.IP · 2

393       Format: (bold|italic|underline|strikethrough|none)
394
395
396       Text style indicates how the highlighted text is emphasized. None indi‐
397       cates that no emphasis should be applied.
398
399       · bold: make the text thicker then the surrounding text.
400
401       · italic: put the highlighted text in script type (slanted).
402
403       · underline: put a line under the highlighted text.
404
405       · strikethrough: put a line through the highlighted text.
406
407       · small caps: emphasise the text using capitalization.
408
409
410              For some reason small caps does not work on some systems.
411
412

Line style.IP · 2

414       Format: (dash|solid)
415
416
417       Indicates how a line should be drawn.  It currently supports:
418        * dash:  a dashed line, where the gap is the same width as the dash
419        * solid: a solid line
420
421

Distance.IP · 2

423       Format: {Integer}px
424
425       · Format: {Real}em
426
427       · Format: {Real}ch
428
429       · Format: {Real}%
430
431       · Format: {Integer}mm
432
433
434       A distance can be specified in 3 different units:
435
436       · px: Screen pixels.
437
438       · em: Relative to text height.
439
440       · ch: Relative to width of a single number.
441
442       · mm: Actual size in millimeters (based on dpi).
443
444       · %:  Percentage of the monitor size.
445
446
447       Distances used in the horizontal direction use the monitor width.  Dis‐
448       tances in the vertical direction use the monitor height.  For example:
449
450
451                 padding: 10%;
452
453
454
455       On a full-HD (1920x1080) monitor, it defines a padding of 192 pixels on
456       the left and right side and 108 pixels on the top and bottom.
457
458
459   Calculating sizes
460       Rofi supports some maths in calculating sizes. For this it uses the CSS
461       syntax:
462
463
464              width: calc( 100% - 37px );
465
466
467
468       It supports the following operations:
469
470       · +   : Add
471
472       · -   : Subtract
473
474       · /   : Divide
475
476       · *   : Multiply
477
478       · %   : Multiply
479
480       · min : Minimum of l or rvalue;
481
482       · max : Maximum of l or rvalue;
483
484
485       It uses the C precedence ordering.
486
487

Padding.IP · 2

489       Format: {Integer}
490
491       · Format: {Distance}
492
493       · Format: {Distance} {Distance}
494
495       · Format: {Distance} {Distance} {Distance}
496
497       · Format: {Distance} {Distance} {Distance} {Distance}
498
499
500       If no unit is specified, pixels are assumed.
501
502
503       The different number of fields in the formats are parsed like:
504
505       · 1 field: all
506
507       · 2 fields: topbottom leftright
508
509       · 3 fields: top, leftright, bottom
510
511       · 4 fields: top, right, bottom, left
512
513

Border.IP · 2

515       Format: {Integer}
516
517       · Format: {Distance}
518
519       · Format: {Distance} {Distance}
520
521       · Format: {Distance} {Distance} {Distance}
522
523       · Format: {Distance} {Distance} {Distance} {Distance}
524
525       · Format: {Distance} {Line style}
526
527       · Format: {Distance} {Line style} {Distance} {Line style}
528
529       · Format:  {Distance}  {Line  style} {Distance} {Line style} {Distance}
530         {Line style}
531
532       · Format: {Distance} {Line style} {Distance}  {Line  style}  {Distance}
533         {Line style} {Distance} {Line style}
534
535
536       Borders are identical to padding, except that each distance field has a
537       line style property.
538
539
540              When no unit is specified, pixels are assumed.
541
542

Position

544       Indicate a place on the window/monitor.
545
546       · Format:  (center|east|north|west|south|north  east|north   west|south
547         west|south east)
548
549
550              north west   |    north    |  north east
551              -------------|-------------|------------
552                    west   |   center    |  east
553              -------------|-------------|------------
554              south west   |    south    |  south east
555
556
557

Visibility

559       It is possible to hide widgets:
560
561
562       inputbar {
563           enabled: false; }
564
565

Reference.IP · 2

567       Format: @{PROPERTY NAME}
568
569
570       A reference can point to another reference. Currently, the maximum num‐
571       ber of redirects is 20.  A property always refers to another  property.
572       It  cannot be used for a subpart of the property.  For example, this is
573       not valid:
574
575
576              highlight: bold @pink;
577
578
579
580       But this is:
581
582
583              * {
584                  myhigh: bold #FAA;
585              }
586
587              window {
588                  highlight: @myhigh;
589              }
590
591
592

Orientation.IP · 2

594       Format: (horizontal|vertical)
595
596
597       Specify the orientation of the widget.
598
599

List of keywords.IP · 2

601       Format: [ keyword, keyword ]
602
603
604       A list starts with a '[' and ends with a ']'. The entries in  the  list
605       are comma-separated.  The keyword in the list refers to an widget name.
606
607

Environment variable.IP · 2

609       Format: ${:alnum:}
610
611
612       This  will  parse the environment variable as the property value. (that
613       then can be any of the above types).  The environment  variable  should
614       be an alphanumeric string without white-space.
615
616
617              * {
618                  background-color: ${BG};
619              }
620
621
622

Inherit.IP · 2

624       Format: inherit
625
626
627       Inherits the property from its parent widget.
628
629
630              mainbox {
631                  border-color: inherit;
632              }
633
634
635

ELEMENTS PATHS

637       Element  paths exists of two parts, the first part refers to the actual
638       widget by name.  Some widgets have an extra state.
639
640
641       For example:
642
643
644              element selected {
645              }
646
647
648
649       Here element selected is the name of the widget, selected is the  state
650       of the widget.
651
652
653       The  difference  between  dots and spaces is purely cosmetic. These are
654       all the same:
655
656
657              element .selected {
658
659              element.selected {
660              }
661              element selected {
662              }
663
664
665

SUPPORTED ELEMENT PATH

Name

668       The current widgets available in rofi:
669
670       · window
671
672       · overlay: the overlay widget.
673
674       · mainbox: The mainbox box.
675
676       · inputbar: The input bar box.
677
678       · box: the horizontal @box packing the widgets
679
680       · case-indicator: the case/sort indicator @textbox
681
682       · prompt: the prompt @textbox
683
684       · entry: the main entry @textbox
685
686       · num-rows: Shows the total number of rows.
687
688       · num-filtered-rows: Shows the total number of rows after filtering.
689
690       · listview: The listview.
691
692       · scrollbar: the listview scrollbar
693
694       · element: a box in the listview holding the entries
695
696       · element-icon:  the  widget  in  the  listview's  entry  showing   the
697         (optional) icon
698
699       · element-index:  the  widget in the listview's entry keybindable index
700         (1,2,3..0)
701
702       · element-text: the widget in the listview's entry showing the text.
703
704       · mode-switcher: the main horizontal @box packing the buttons.
705
706       · button: the buttons @textbox for each mode
707
708       · message: The container holding the textbox.
709
710       · textbox: the message textbox
711
712
713       Note that these path names match the default theme. Themes that provide
714       a custom layout will have different elements, and structure.
715
716

State

718       State: State of widget
719
720
721       Optional flag(s) indicating state of the widget, used for theming.
722
723
724       These are appended after the name or class of the widget.
725
726
727   Example:
728       button selected.normal { }
729
730
731       element selected.urgent { }
732
733
734       Currently only the entrybox and scrollbar have states:
735
736
737   Entrybox:
738       {visible modifier}.{state}
739
740
741       Where visible modifier can be:
742        * normal: no modification
743        * selected: the entry is selected/highlighted by user
744        * alternate: the entry is at an alternating row (uneven row)
745
746
747       Where state is:
748        * normal: no modification
749        * urgent: this entry is marked urgent
750        * active: this entry is marked active
751
752
753       These can be mixed.
754
755
756       Example:
757
758
759              nametotextbox selected.active {
760                  background-color: #003642;
761                  text-color: #008ed4;
762              }
763
764
765
766       Sets  all  selected textboxes marked active to the given text and back‐
767       ground color.  Note that a state  modifies  the  original  element,  it
768       therefore contains all the properties of that element.
769
770
771   Scrollbar
772       The  scrollbar  uses  the handle state when drawing the small scrollbar
773       handle.  This allows the colors used for drawing the handle to  be  set
774       independently.
775
776

SUPPORTED PROPERTIES

778       The following properties are currently supported:
779
780
781   all widgets:.IP · 2
782       enabled:         enable/disable the widget
783
784       · padding:         padding Padding on the inside of the widget
785
786       · margin:          padding Margin on the outside of the widget
787
788       · border:          border Border around the widget (between padding and
789         margin)/
790
791       · border-radius:    padding Sets a radius on the corners  of  the  bor‐
792         ders.
793
794       · background-color:      color Background color
795
796       · border-color:      color Color of the border
797
798
799   window:.IP · 2
800       font:            string The font used in the window
801
802       ·
803
804
805       transparency:     string  Indicating if transparency should be used and
806       what type: real - True transparency.  Only  works  with  a  compositor.
807       background  -  Take  a screenshot of the background image and use that.
808       screenshot - Take a screenshot of the screen and use that.  Path to png
809       file - Use an image.
810
811       ·
812
813
814       location:       position The place of the anchor on the monitor
815
816       ·
817
818
819       anchor:         anchor The anchor position on the window
820
821       ·
822
823
824       fullscreen:     boolean Window is fullscreen.
825
826       ·
827
828
829       width:          distance The width of the window
830
831       ·
832
833
834       x-offset:  distance
835
836       ·
837
838
839       y-offset:   distance  The  offset  of  the  window to the anchor point,
840       allowing you to push the window left/right/up/down
841
842
843   scrollbar:.IP · 2
844       background-color:    color
845
846       · handle-width:        distance
847
848       · handle-color:        color
849
850       · border-color:        color
851
852
853   box:.IP · 2
854       orientation:      orientation
855           Set the direction the elements are packed.
856
857       · spacing:         distance
858             Distance between the packed elements.
859
860
861   textbox:.IP · 2
862       background-color:  color
863
864       · border-color:      the color used for the border around the widget.
865
866       · font:              the font used by this textbox (string).
867
868       · str:               the string to display by this textbox (string).
869
870       · vertical-align:    vertical alignment of the text (0 top, 1 bottom).
871
872       · horizontal-align:  horizontal  alignment  of  the  text  (0  left,  1
873         right).
874
875       · text-color:        the text color to use.
876
877       · highlight:          text  style {color}.  color is optional, multiple
878         highlight styles can be added like: bold underline italic #000000;
879
880       · width:             override the desired width for the textbox.
881
882       · content:           Set the displayed text (String).
883
884       · placeholder:       Set the displayed text (String)  when  nothing  is
885         entered.
886
887       · placeholder-color: Color of the placeholder text.
888
889       · blink:             Enable/Disable blinking on an input textbox (Bool‐
890         ean).
891
892
893   listview:.IP · 2
894       columns:         integer Number of columns to show (at least 1)
895
896       · fixed-height:    boolean Always show lines rows, even if  fewer  ele‐
897         ments are available.
898
899       · dynamic:          boolean True if the size should change when filter‐
900         ing the list, False if it should keep the original height.
901
902       · scrollbar:       boolean If the scrollbar should be enabled/disabled.
903
904       · scrollbar-width: distance Width of the scrollbar
905
906       · cycle:           boolean When navigating, it should wrap around
907
908       · spacing:         distance Spacing between the elements (both vertical
909         and horizontal)
910
911       · lines:           integer Number of rows to show in the list view.
912
913       · layout:           orientation Indicate how elements are stacked. Hor‐
914         izontal implements the dmenu style.
915
916       · reverse:         boolean Reverse the ordering  (top  down  to  bottom
917         up).
918
919       · fixed-columns:     boolean  Do not reduce the number of columns shown
920         when number of visible elements is not enough to fill them all.
921
922
923       Each element is a box called element. Each element can contain an  ele‐
924       ment-icon and element-text.
925
926
927   listview text highlight:
928       The  element-text  widget  in  the listview is the one used to show the
929       text.  On this widget set the highlight property (only place this prop‐
930       erty is used) to change the style of highlighting.  The highlight prop‐
931       erty consist of the text-style property and a color.
932
933
934       To disable highlighting:
935
936
937                element-text {
938                  highlight: None;
939                }
940
941
942
943       To set to red underlined:
944
945
946                element-text {
947                  highlight: underline red;
948                }
949
950
951

Layout

953       The new format allows the layout of  the  rofi  window  to  be  tweaked
954       extensively.   For each widget, the themer can specify padding, margin,
955       border, font, and more.  It even allows, as  an  advanced  feature,  to
956       pack widgets in a custom structure.
957
958
959   Basic structure
960       The  whole  view is made out of boxes that pack other boxes or widgets.
961       The box can be vertical or horizontal. This is loosely inspired by  GTK
962http://gtk.org/⟩.
963
964
965       The current layout of rofi is structured as follows:
966
967
968              |------------------------------------------------------------------------------------|
969              | window {BOX:vertical}                                                              |
970              | |-------------------------------------------------------------------------------|  |
971              | | mainbox  {BOX:vertical}                                                       |  |
972              | | |---------------------------------------------------------------------------| |  |
973              | | | inputbar {BOX:horizontal}                                                 | |  |
974              | | | |---------| |-----------------------------------------------------| |---| | |  |
975              | | | | prompt  | | entry                                               | |ci | | |  |
976              | | | |---------| |-----------------------------------------------------| |---| | |  |
977              | | |---------------------------------------------------------------------------| |  |
978              | |                                                                               |  |
979              | | |---------------------------------------------------------------------------| |  |
980              | | | message                                                                   | |  |
981              | | | |-----------------------------------------------------------------------| | |  |
982              | | | | textbox                                                               | | |  |
983              | | | |-----------------------------------------------------------------------| | |  |
984              | | |---------------------------------------------------------------------------| |  |
985              | |                                                                               |  |
986              | | |-----------------------------------------------------------------------------|  |
987              | | | listview                                                                    |  |
988              | | |-----------------------------------------------------------------------------|  |
989              | |                                                                               |  |
990              | | |---------------------------------------------------------------------------| |  |
991              | | |  mode-switcher {BOX:horizontal}                                           | |  |
992              | | | |---------------|   |---------------|  |--------------| |---------------| | |  |
993              | | | | Button        |   | Button        |  | Button       | | Button        | | |  |
994              | | | |---------------|   |---------------|  |--------------| |---------------| | |  |
995              | | |---------------------------------------------------------------------------| |  |
996              | |-------------------------------------------------------------------------------|  |
997              |------------------------------------------------------------------------------------|
998
999
1000
1001
1002
1003              ci is the case-indicator
1004
1005
1006   Error message structure
1007              |-----------------------------------------------------------------------------------|
1008              | window {BOX:vertical}                                                             |
1009              | |------------------------------------------------------------------------------|  |
1010              | | error-message {BOX:vertical}                                                 |  |
1011              | | |-------------------------------------------------------------------------|  |  |
1012              | | | textbox                                                                 |  |  |
1013              | | |-------------------------------------------------------------------------|  |  |
1014              | |------------------------------------------------------------------------------|  |
1015              |-----------------------------------------------------------------------------------|
1016
1017
1018
1019
1020
1021   Advanced layout
1022       The  layout  of rofi can be tweaked by packing the 'fixed' widgets in a
1023       custom structure.
1024
1025
1026       The following widgets are fixed, as they provide core rofi  functional‐
1027       ity:
1028
1029       · prompt
1030
1031       · entry
1032
1033       · overlay
1034
1035       · case-indicator
1036
1037       · message
1038
1039       · listview
1040
1041       · mode-switcher
1042
1043       · num-rows
1044
1045       · num-filtered-rows
1046
1047
1048       The  following  keywords  are  defined and can be used to automatically
1049       pack a subset of the widgets.  These are used in the default  theme  as
1050       depicted in the figure above.
1051
1052       · mainbox Packs: inputbar, message, listview, mode-switcher
1053
1054       · inputbar Packs: prompt,entry,case-indicator
1055
1056
1057       Any  widget  name starting with textbox is a textbox widget, others are
1058       box widgets and can pack other widgets.
1059
1060
1061       There are several special widgets that can be  used  by  prefixing  the
1062       name of the widget:
1063
1064       · textbox:  This  is  a textbox widget. The displayed string can be set
1065         with str.
1066
1067       · icon: This is an icon widget. The displayed  icon  can  be  set  with
1068         filename and size with size.
1069
1070       · button:  This is a textbox widget that can have a 'clickable' action.
1071         The action can be set to: ok  accept  entry.   custom  accept  custom
1072         input.   ok|alternate:  accept entry and launch alternate action (for
1073         run launch in terminal).  custom|alternate: accept custom  input  and
1074         launch alternate action.
1075
1076
1077       To  specify children, set the children property (this always happens on
1078       the box child, see example below):
1079
1080
1081              children: [prompt,entry,overlay,case-indicator];
1082
1083
1084
1085       The theme needs to be updated to match the hierarchy specified.
1086
1087
1088       Below is an example of a theme emulating dmenu:
1089
1090
1091              * {
1092                  background-color:      Black;
1093                  text-color:            White;
1094                  border-color:          White;
1095                  font:            "Times New Roman 12";
1096              }
1097
1098              window {
1099                  anchor:     north;
1100                  location:   north;
1101                  width:      100%;
1102                  padding:    4px;
1103                  children:   [ horibox ];
1104              }
1105
1106              horibox {
1107                  orientation: horizontal;
1108                  children:   [ prompt, entry, listview ];
1109              }
1110
1111              listview {
1112                  layout:     horizontal;
1113                  spacing:    5px;
1114                  lines:      10;
1115              }
1116
1117              entry {
1118                  expand:     false;
1119                  width:      10em;
1120              }
1121
1122              element {
1123                  padding: 0px 2px;
1124              }
1125              element selected {
1126                  background-color: SteelBlue;
1127              }
1128
1129
1130
1131   Padding and margin
1132       Just like CSS, rofi uses the box model for each widget.
1133
1134
1135              |-------------------------------------------------------------------|
1136              | margin                                                            |
1137              |  |-------------------------------------------------------------|  |
1138              |  | border                                                      |  |
1139              |  | |---------------------------------------------------------| |  |
1140              |  | | padding                                                 | |  |
1141              |  | | |-----------------------------------------------------| | |  |
1142              |  | | | content                                             | | |  |
1143              |  | | |-----------------------------------------------------| | |  |
1144              |  | |---------------------------------------------------------| |  |
1145              |  |-------------------------------------------------------------|  |
1146              |-------------------------------------------------------------------|
1147
1148
1149
1150       Explanation of the different parts:
1151
1152       · Content - The content of the widget.
1153
1154       · Padding - Clears an area around the widget.  The  padding  shows  the
1155         background color of the widget.
1156
1157       · Border - A border that goes around the padding and content.  The bor‐
1158         der use the border-color of the widget.
1159
1160       · Margin - Clears an area outside the border.  The margin is  transpar‐
1161         ent.
1162
1163
1164       The  box model allows us to add a border around elements, and to define
1165       space between elements.
1166
1167
1168       The size of each margin, border, and padding can be set.  For the  bor‐
1169       der, a linestyle and radius can be set.
1170
1171
1172   Spacing
1173       Widgets  that  can  pack  more then one child widget (currently box and
1174       listview) have the spacing property.  This property sets  the  distance
1175       between the packed widgets (both horizontally and vertically).
1176
1177
1178              |---------------------------------------|
1179              |  |--------| s |--------| s |-------|  |
1180              |  | child  | p | child  | p | child |  |
1181              |  |        | a |        | a |       |  |
1182              |  |        | c |        | c |       |  |
1183              |  |        | i |        | i |       |  |
1184              |  |        | n |        | n |       |  |
1185              |  |--------| g |--------| g |-------|  |
1186              |---------------------------------------|
1187
1188
1189
1190   Advanced box packing
1191       More dynamic spacing can be achieved by adding dummy widgets, for exam‐
1192       ple to make one widget centered:
1193
1194
1195              |--------------------------------------------|
1196              |  |-----------|  |--------|  |-----------|  |
1197              |  | dummy     |  | child  |  | dummy     |  |
1198              |  | expand: y |  |        |  | expand: y |  |
1199              |  |           |  |        |  |           |  |
1200              |  |           |  |        |  |           |  |
1201              |  |           |  |        |  |           |  |
1202              |  |-----------|  |--------|  |-----------|  |
1203              |--------------------------------------------|
1204
1205
1206
1207       If both dummy widgets are  set  to  expand,  child  will  be  centered.
1208       Depending  on  the  expand  flag  of  child the remaining space will be
1209       equally divided between both dummy and child widget  (expand  enabled),
1210       or both dummy widgets (expand disabled).
1211
1212

DEBUGGING

1214       To get debug information from the parser, run rofi like:
1215
1216
1217              G_MESSAGES_DEBUG=Parser rofi -show run
1218
1219
1220
1221       Syntax errors are shown in a popup and printed out to command line with
1222       the above command.
1223
1224
1225       To see the elements queried during running, run:
1226
1227
1228              G_MESSAGES_DEBUG=Theme rofi -show run
1229
1230
1231
1232       To test minor changes, part of the theme can be passed on  the  command
1233       line, for example to set it to full-screen:
1234
1235
1236              rofi -theme-str '#window { fullscreen:true;}' -show run
1237
1238
1239
1240       To print the current theme, run:
1241
1242
1243              rofi -dump-theme
1244
1245
1246

Media support

1248       Parts  of  the  theme  can be conditionally loaded, like the CSS @media
1249       option.
1250
1251
1252              @media ( min-width: 120 ) {
1253
1254              }
1255
1256
1257
1258       It supports the following keys as constraint:
1259
1260       · min-width:         load when width is bigger or equal then value.
1261
1262       · max-width:         load when width is smaller then value.
1263
1264       · min-height:        load when height is bigger or equal then value.
1265
1266       · max-height:        load when height is smaller then value.
1267
1268       · min-aspect-ratio   load when aspect ratio is over value.
1269
1270       · max-aspect-ratio:  load when aspect ratio is under value.
1271
1272       · monitor-id:        The monitor id, see rofi -help for id's.
1273
1274
1275       @media takes an integer number or a fraction, for integer number px can
1276       be added.
1277
1278
1279              @media ( min-width: 120 px ) {
1280
1281              }
1282
1283
1284

Multiple file handling

1286       The rasi file format offers two methods of including other files.  This
1287       can be used to modify existing themes, or have multiple variations on a
1288       theme.
1289
1290       · import:  Import and parse a second file.
1291
1292       · theme:   Discard theme, and load file as a fresh theme.
1293
1294
1295       Syntax:
1296
1297
1298              @import "myfile"
1299              @theme "mytheme"
1300
1301
1302
1303       The specified file can either by name, filename,full path.
1304
1305
1306       If  a  filename is provided, it will try to resolve it in the following
1307       order:
1308
1309       · ${XDG_CONFIG_HOME}/rofi/themes/
1310
1311       · ${XDG_CONFIG_HOME}/rofi/
1312
1313       · ${XDG_DATA_HOME}/rofi/themes/
1314
1315       · ${INSTALL PREFIX}/share/rofi/themes/
1316
1317
1318       A name is resolved as a filename by appending the .rasi extension.
1319
1320

EXAMPLES

1322       Several examples are installed together with rofi. These can  be  found
1323       in  {datadir}/rofi/themes/, where {datadir} is the install path of rofi
1324       data.  When  installed  using  a  package  manager,  this  is  usually:
1325       /usr/share/.
1326
1327

SEE ALSO

1329       rofi(1), rofi-script(5), rofi-theme-selector(1)
1330
1331
1332
1333                                  rofi-theme                     ROFI-THEME(5)
Impressum