1ROFI-THEME(5) File Formats Manual ROFI-THEME(5)
2
3
4
6 rofi-theme - Rofi theme format files
7
8
10 By default, rofi loads the default theme. This theme is always loaded.
11 In the default (always loaded) configuration it does:
12
13
14 @theme "default"
15
16
17
18 To unload the default theme, and load another theme, add @theme to your
19 config.rasi file.
20
21
22 If you have a theme loaded by @theme or use the default theme, you can
23 tweak it by adding overriding elements at the end of your config.rasi
24 file.
25
26
27 For the difference between @import and @theme see the Multiple file
28 handling section in this manpage.
29
30
31 To see the default theme, run the following command:
32
33
34 rofi -no-config -dump-theme
35
36
37
39 The need for a new theme format was motivated by the fact that the way
40 rofi handled widgets has changed. From a very static drawing of lines
41 and text to a nice structured form of packing widgets. This change made
42 it possible to provide a more flexible theme framework. The old theme
43 format and config file are not flexible enough to expose these options
44 in a user-friendly way. Therefore, a new file format has been created,
45 replacing the old one.
46
47
50 The encoding of the file is utf-8. Both unix (\n) and windows (\r\n)
51 newlines format are supported. But unix is preferred.
52
53
55 C and C++ file comments are supported.
56
57
58 • Anything after // and before a newline is considered a com‐
59 ment.
60
61 • Everything between /* and */ is a comment.
62
63
64
65 Comments can be nested and the C comments can be inline.
66
67
68 The following is valid:
69
70
71 // Magic comment.
72 property: /* comment */ value;
73
74
75
76 However, this is not:
77
78
79 prop/*comment*/erty: value;
80
81
82
84 White space and newlines, like comments, are ignored by the parser.
85
86
87 This:
88
89
90 property: name;
91
92
93
94 Is identical to:
95
96
97 property :
98 name
99
100 ;
101
102
103
105 The preferred file extension for the new theme format is rasi. This is
106 an abbreviation for rofi advanced style information.
107
108
110 Each element has a section with defined properties. Global properties
111 can be defined in section * { }. Sub-section names begin with a hash
112 symbol #.
113
114
115 It is advised to define the global properties section on top of the
116 file to make inheritance of properties clearer.
117
118
119 /* Global properties section */
120 * {
121 // list of properties
122 }
123
124 /* Element theme section. */
125 {element path} {
126 // list of properties
127 }
128 {elements... } {
129 // list of properties
130 }
131
132
133
134 If there are multiple sections with the same name, they are merged. Du‐
135 plicate properties are overwritten and the last parsed entry kept.
136
137
139 A theme can have one or more global properties sections. If there is
140 more than one, they will be merged.
141
142
143 The global properties section denotes the defaults for each element.
144 Each property of this section can be referenced with @{identifier} (See
145 Properties section)
146
147
148 A global properties section is indicated with a * as element path.
149
150
152 A theme can have multiple element theme sections.
153
154
155 The element path can consist of multiple names separated by whitespace
156 or dots. Each element may contain any number of letters, numbers and
157 -'s. The first element in the element path should always start with a
158 #. Multiple elements can be specified by a ,.
159
160
161 This is a valid element name:
162
163
164 element normal.normal {
165 background-color: blue;
166 }
167 button {
168 background-color: blue;
169 }
170
171
172
173 And is identical to:
174
175
176 element normal normal, button {
177 background-color: blue;
178 }
179
180
181
182 Each section inherits the global properties. Properties can be explic‐
183 itly inherited from their parent with the inherit keyword. In the fol‐
184 lowing example:
185
186
187 window {
188 a: 1;
189 b: 2;
190 children: [ mainbox ];
191 }
192 mainbox {
193 a: inherit;
194 b: 4;
195 c: 8;
196 }
197
198
199
200 The element mainbox will have the following set of properties (if main‐
201 box is a child of window):
202
203
204 a: 1;
205 b: 4;
206 c: 8;
207
208
209
210 If multiple sections are defined with the same name, they are merged by
211 the parser. If multiple properties with the same name are defined in
212 one section, the last encountered property is used.
213
214
216 The properties in a section consist of:
217
218
219 {identifier}: {value};
220
221
222
223 Both fields are mandatory for a property.
224
225
226 The identifier names the specified property. Identifiers can consist of
227 any combination of numbers, letters and '-'. It must not contain any
228 whitespace. The structure of the value defines the type of the prop‐
229 erty. The current parser does not define or enforce a certain type of a
230 particular identifier. When used, values with the wrong type that can‐
231 not be converted are ignored.
232
233
234 The current theme format supports different types:
235
236
237 • a string
238
239 • an integer number
240
241 • a fractional number
242
243 • a boolean value
244
245 • a color
246
247 • image
248
249 • text style
250
251 • line style
252
253 • a distance
254
255 • a padding
256
257 • a border
258
259 • a position
260
261 • a reference
262
263 • an orientation
264
265 • a cursor
266
267 • a list of keywords
268
269 • an array of values
270
271 • an environment variable
272
273 • Inherit
274
275
276
277 Some of these types are a combination of other types.
278
279
281 • Format: "[:print:]+"
282
283
284
285 A string is always surrounded by double quotes ("). Between the quotes
286 there can be any printable character.
287
288
289 For example:
290
291
292 font: "Awasome 12";
293
294
295
296 The string must be valid UTF-8.
297
298
300 • Format: [-+]?[:digit:]+
301
302
303
304 An integer may contain any number.
305
306
307 For examples:
308
309
310 lines: 12;
311
312
313
315 • Format: [-+]?[:digit:]+(\.[:digit:]+)?
316
317
318
319 A real is an integer with an optional fraction.
320
321
322 For example:
323
324
325 real: 3.4;
326
327
328
329 The following is not valid: .3, 3. or scientific notation: 3.4e-3.
330
331
333 • Format: (true|false)
334
335
336
337 Boolean value is either true or false. This is case-sensitive.
338
339
340 For example:
341
342
343 dynamic: false;
344
345
346
348 rofi support a limited set of background-image formats.
349
350
351 • Format: url("path to image");
352
353 • Format: url("path to image", scale); where scale is: none,
354 both, width, height
355
356 • Format: linear-gradient(stop color,stop1, color, stop2 color,
357 ...);
358
359 • Format: linear-gradient(to direction, stop color,stop1, color,
360 stop2 color, ...); where direction is: top,left,right,bot‐
361 tom.
362
363 • Format: linear-gradient(angle, stop color,stop1, color, stop2
364 color, ...); Angle in deg,rad,grad (as used in color).
365
366
367
368 Where the path is a string, and stop color is of type color.
369
370
372 rofi supports the color formats as specified in the CSS standard (1,2,3
373 and some of CSS 4)
374
375
376 • Format: #{HEX}{3} (rgb)
377
378 • Format: #{HEX}{4} (rgba)
379
380 • Format: #{HEX}{6} (rrggbb)
381
382 • Format: #{HEX}{8} (rrggbbaa)
383
384 • Format: rgb[a]({INTEGER},{INTEGER},{INTEGER}[, {PERCENTAGE}])
385
386 • Format: rgb[a]({INTEGER}%,{INTEGER}%,{INTEGER}%[, {PERCENT‐
387 AGE}])
388
389 • Format: hsl[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [, {PER‐
390 CENTAGE}])
391
392 • Format: hwb[a]( {ANGLE}, {PERCENTAGE}, {PERCENTAGE} [, {PER‐
393 CENTAGE}])
394
395 • Format: cmyk( {PERCENTAGE}, {PERCENTAGE}, {PERCENTAGE}, {PER‐
396 CENTAGE} [, {PERCENTAGE} ])
397
398 • Format: {named-color} [ / {PERCENTAGE} ]
399
400
401
402 The white-space format proposed in CSS4 is also supported.
403
404
405 The different values are:
406
407
408 • {HEX} is a hexadecimal number ('0-9a-f' case insensitive).
409
410 • {INTEGER} value can be between 0 and 255 or 0-100 when repre‐
411 senting percentage.
412
413 • {ANGLE} is the angle on the color wheel, can be in deg, rad,
414 grad or turn. When no unit is specified, degrees is assumed.
415
416 • {PERCENTAGE} can be between 0-1.0, or 0%-100%
417
418 •
419
420
421 {named-color} is one of the following colors:
422
423 AliceBlue, AntiqueWhite, Aqua, Aquamarine, Azure, Beige, Bisque,
424 Black, BlanchedAlmond, Blue, BlueViolet, Brown, BurlyWood,
425 CadetBlue, Chartreuse, Chocolate, Coral, CornflowerBlue, Corn‐
426 silk, Crimson, Cyan, DarkBlue, DarkCyan, DarkGoldenRod, Dark‐
427 Gray, DarkGrey, DarkGreen, DarkKhaki, DarkMagenta, DarkOliveG‐
428 reen, DarkOrange, DarkOrchid, DarkRed, DarkSalmon, DarkSeaGreen,
429 DarkSlateBlue, DarkSlateGray, DarkSlateGrey, DarkTurquoise,
430 DarkViolet, DeepPink, DeepSkyBlue, DimGray, DimGrey, DodgerBlue,
431 FireBrick, FloralWhite, ForestGreen, Fuchsia, Gainsboro, Ghost‐
432 White, Gold, GoldenRod, Gray, Grey, Green, GreenYellow, Honey‐
433 Dew, HotPink, IndianRed, Indigo, Ivory, Khaki, Lavender, Laven‐
434 derBlush, LawnGreen, LemonChiffon, LightBlue, LightCoral, Light‐
435 Cyan, LightGoldenRodYellow, LightGray, LightGrey, LightGreen,
436 LightPink, LightSalmon, LightSeaGreen, LightSkyBlue, LightS‐
437 lateGray, LightSlateGrey, LightSteelBlue, LightYellow, Lime,
438 LimeGreen, Linen, Magenta, Maroon, MediumAquaMarine, MediumBlue,
439 MediumOrchid, MediumPurple, MediumSeaGreen, MediumSlateBlue,
440 MediumSpringGreen, MediumTurquoise, MediumVioletRed, Midnight‐
441 Blue, MintCream, MistyRose, Moccasin, NavajoWhite, Navy, Old‐
442 Lace, Olive, OliveDrab, Orange, OrangeRed, Orchid, PaleGolden‐
443 Rod, PaleGreen, PaleTurquoise, PaleVioletRed, PapayaWhip, Peach‐
444 Puff, Peru, Pink, Plum, PowderBlue, Purple, RebeccaPurple, Red,
445 RosyBrown, RoyalBlue, SaddleBrown, Salmon, SandyBrown, SeaGreen,
446 SeaShell, Sienna, Silver, SkyBlue, SlateBlue, SlateGray, Slate‐
447 Grey, Snow, SpringGreen, SteelBlue, Tan, Teal, Thistle, Tomato,
448 Turquoise, Violet, Wheat, White, WhiteSmoke, Yellow, Yellow‐
449 Green,transparent
450
451
452
453 For example:
454
455
456 background-color: #FF0000;
457 border-color: rgba(0,0,1, 0.5);
458 text-color: SeaGreen;
459
460
461
462 or
463
464
465 background-color: transparent;
466 text-color: Black;
467
468
469
471 • Format: (bold|italic|underline|strikethrough|none)
472
473
474
475 Text style indicates how the highlighted text is emphasized. None indi‐
476 cates that no emphasis should be applied.
477
478
479 • bold: make the text thicker then the surrounding text.
480
481 • italic: put the highlighted text in script type (slanted).
482
483 • underline: put a line under the highlighted text.
484
485 • strikethrough: put a line through the highlighted text.
486
487
488
490 • Format: (dash|solid)
491
492
493
494 Indicates how a line should be drawn. It currently supports:
495 * dash: a dashed line, where the gap is the same width as the dash
496 * solid: a solid line
497
498
500 • Format: {Integer}px
501
502 • Format: {Real}em
503
504 • Format: {Real}ch
505
506 • Format: {Real}%
507
508 • Format: {Integer}mm
509
510
511
512 A distance can be specified in 3 different units:
513
514
515 • px: Screen pixels.
516
517 • em: Relative to text height.
518
519 • ch: Relative to width of a single number.
520
521 • mm: Actual size in millimeters (based on dpi).
522
523 • %: Percentage of the monitor size.
524
525
526
527 Distances used in the horizontal direction use the monitor width. Dis‐
528 tances in the vertical direction use the monitor height. For example:
529
530
531 padding: 10%;
532
533
534
535 On a full-HD (1920x1080) monitor, it defines a padding of 192 pixels on
536 the left and right side and 108 pixels on the top and bottom.
537
538
539 Calculating sizes
540 Rofi supports some maths in calculating sizes. For this it uses the CSS
541 syntax:
542
543
544 width: calc( 100% - 37px );
545
546
547
548 It supports the following operations:
549
550
551 • + : Add
552
553 • - : Subtract
554
555 • / : Divide
556
557 • * : Multiply
558
559 • % : Multiply
560
561 • min : Minimum of l or rvalue;
562
563 • max : Maximum of l or rvalue;
564
565 • floor : Round down lvalue to the next multiple of rvalue
566
567 • ceil : Round up lvalue to the next multiple of rvalue
568
569 • round : Round lvalue to the next multiple of rvalue
570
571
572
573 It uses the C precedence ordering.
574
575
577 • Format: {Integer}
578
579 • Format: {Distance}
580
581 • Format: {Distance} {Distance}
582
583 • Format: {Distance} {Distance} {Distance}
584
585 • Format: {Distance} {Distance} {Distance} {Distance}
586
587
588
589 If no unit is specified, pixels are assumed.
590
591
592 The different number of fields in the formats are parsed like:
593
594
595 • 1 field: all
596
597 • 2 fields: topbottom leftright
598
599 • 3 fields: top, leftright, bottom
600
601 • 4 fields: top, right, bottom, left
602
603
604
606 • Format: {Integer}
607
608 • Format: {Distance}
609
610 • Format: {Distance} {Distance}
611
612 • Format: {Distance} {Distance} {Distance}
613
614 • Format: {Distance} {Distance} {Distance} {Distance}
615
616 • Format: {Distance} {Line style}
617
618 • Format: {Distance} {Line style} {Distance} {Line style}
619
620 • Format: {Distance} {Line style} {Distance} {Line style} {Dis‐
621 tance} {Line style}
622
623 • Format: {Distance} {Line style} {Distance} {Line style} {Dis‐
624 tance} {Line style} {Distance} {Line style}
625
626
627
628 Borders are identical to padding, except that each distance field has a
629 line style property.
630
631
632 When no unit is specified, pixels are assumed.
633
634
636 Indicate a place on the window/monitor.
637
638
639 •
640
641
642 Format: (center|east|north|west|south|north east|north
643 west|south west|south east)
644
645 north west | north | north east
646 -------------|-------------|------------
647 west | center | east
648 -------------|-------------|------------
649 south west | south | south east
650
651
652
653
655 It is possible to hide widgets:
656
657
658 inputbar {
659 enabled: false; }
660
661
663 • Format: @{PROPERTY NAME}
664
665
666
667 A reference can point to another reference. Currently, the maximum num‐
668 ber of redirects is 20. A property always refers to another property.
669 It cannot be used for a subpart of the property. For example, this is
670 not valid:
671
672
673 highlight: bold @pink;
674
675
676
677 But this is:
678
679
680 * {
681 myhigh: bold #FAA;
682 }
683
684 window {
685 highlight: @myhigh;
686 }
687
688
689
690 • Format: var(PROPERTY NAME, DEFAULT)
691
692
693
694 A reference can point to another reference. Currently, the maximum num‐
695 ber of redirects is 20. A property always refers to another property.
696 It cannot be used for a subpart of the property.
697
698
699 Example:
700
701
702 window {
703 width: var( width, 30%);
704 }
705
706
707
708 If the property width is set globally (*{}) that value is used, if the
709 property width is not set, the default value is used.
710
711
713 • Format: (horizontal|vertical)
714
715
716
717 Specify the orientation of the widget.
718
719
721 • Format: (default|pointer|text)
722
723
724
725 Specify the type of mouse cursor that is set when the mouse pointer is
726 over the widget.
727
728
730 • Format: [ keyword, keyword ]
731
732
733
734 A list starts with a '[' and ends with a ']'. The entries in the list
735 are comma-separated. The keyword in the list refers to an widget name.
736
737
739 • Format: [ value, value, ... ]
740
741
742
743 An list starts with a '[' and ends with a ']'. The entries in the list
744 are comma-separated.
745
746
748 • Format: ${:alnum:}
749
750
751
752 This will parse the environment variable as the property value. (that
753 then can be any of the above types). The environment variable should
754 be an alphanumeric string without white-space.
755
756
757 * {
758 background-color: ${BG};
759 }
760
761
762
763 • Format: env(ENVIRONMENT, default)
764
765
766
767 This will parse the environment variable as the property value. (that
768 then can be any of the above types). The environment variable should
769 be an alphanumeric string without white-space. If the environment
770 value is not found, the default value is used.
771
772
773 window {
774 width: env(WIDTH, 40%);
775 }
776
777
778
779 If environment WIDTH is set, then that value is parsed, otherwise the
780 default value (40%).
781
782
784 • Format: inherit
785
786
787
788 Inherits the property from its parent widget.
789
790
791 mainbox {
792 border-color: inherit;
793 }
794
795
796
798 Element paths exists of two parts, the first part refers to the actual
799 widget by name. Some widgets have an extra state.
800
801
802 For example:
803
804
805 element selected {
806 }
807
808
809
810 Here element selected is the name of the widget, selected is the state
811 of the widget.
812
813
814 The difference between dots and spaces is purely cosmetic. These are
815 all the same:
816
817
818 element .selected {
819
820 element.selected {
821 }
822 element selected {
823 }
824
825
826
829 The current widgets available in rofi:
830
831
832 • window
833
834
835 • overlay: the overlay widget.
836
837 • mainbox: The mainbox box.
838
839 • inputbar: The input bar box.
840
841
842 • box: the horizontal @box packing the widgets
843
844 • case-indicator: the case/sort indicator @textbox
845
846 • prompt: the prompt @textbox
847
848 • entry: the main entry @textbox
849
850 • num-rows: Shows the total number of rows.
851
852 • num-filtered-rows: Shows the total number of rows after
853 filtering.
854
855
856 • listview: The listview.
857
858
859 • scrollbar: the listview scrollbar
860
861 • element: a box in the listview holding the entries
862
863
864 • element-icon: the widget in the listview's entry showing
865 the (optional) icon
866
867 • element-index: the widget in the listview's entry key‐
868 bindable index (1,2,3..0)
869
870 • element-text: the widget in the listview's entry showing
871 the text.
872
873
874
875 • mode-switcher: the main horizontal @box packing the buttons.
876
877
878 • button: the buttons @textbox for each mode
879
880
881 • message: The container holding the textbox.
882
883
884 • textbox: the message textbox
885
886
887
888
889
890 Note that these path names match the default theme. Themes that provide
891 a custom layout will have different elements, and structure.
892
893
895 State: State of widget
896
897
898 Optional flag(s) indicating state of the widget, used for theming.
899
900
901 These are appended after the name or class of the widget.
902
903
904 Example:
905 button selected.normal { }
906
907
908 element selected.urgent { }
909
910
911 Currently only the entrybox and scrollbar have states:
912
913
914 Entrybox:
915 {visible modifier}.{state}
916
917
918 Where visible modifier can be:
919 * normal: no modification
920 * selected: the entry is selected/highlighted by user
921 * alternate: the entry is at an alternating row (uneven row)
922
923
924 Where state is:
925 * normal: no modification
926 * urgent: this entry is marked urgent
927 * active: this entry is marked active
928
929
930 These can be mixed.
931
932
933 Example:
934
935
936 nametotextbox selected.active {
937 background-color: #003642;
938 text-color: #008ed4;
939 }
940
941
942
943 Sets all selected textboxes marked active to the given text and back‐
944 ground color. Note that a state modifies the original element, it
945 therefore contains all the properties of that element.
946
947
948 Scrollbar
949 The scrollbar uses the handle state when drawing the small scrollbar
950 handle. This allows the colors used for drawing the handle to be set
951 independently.
952
953
955 The following properties are currently supported:
956
957
958 all widgets:
959 • enabled: enable/disable the widget
960
961 • padding: padding Padding on the inside of the widget
962
963 • margin: padding Margin on the outside of the widget
964
965 • border: border Border around the widget (between pad‐
966 ding and margin)/
967
968 • border-radius: padding Sets a radius on the corners of the
969 borders.
970
971 • background-color: color Background color
972
973 • background-image: image Background image
974
975 • border-color: color Color of the border
976
977 • cursor: cursor Type of mouse cursor that is set when the
978 mouse pointer is hovered over the widget.
979
980
981
982 window:
983 •
984
985
986 font: string The font used in the window
987
988 •
989
990
991 transparency: string Indicating if transparency should be
992 used and what type: real - True transparency. Only works with a
993 compositor. background - Take a screenshot of the background
994 image and use that. screenshot - Take a screenshot of the
995 screen and use that. Path to png file - Use an image.
996
997 •
998
999
1000 location: position The place of the anchor on the monitor
1001
1002 •
1003
1004
1005 anchor: anchor The anchor position on the window
1006
1007 •
1008
1009
1010 fullscreen: boolean Window is fullscreen.
1011
1012 •
1013
1014
1015 width: distance The width of the window
1016
1017 •
1018
1019
1020 x-offset: distance
1021
1022 •
1023
1024
1025 y-offset: distance The offset of the window to the anchor
1026 point, allowing you to push the window left/right/up/down
1027
1028
1029
1030 scrollbar:
1031 • background-color: color
1032
1033 • handle-width: distance
1034
1035 • handle-color: color
1036
1037 • border-color: color
1038
1039
1040
1041 box:
1042 • orientation: orientation
1043 Set the direction the elements are packed.
1044
1045 • spacing: distance
1046 Distance between the packed elements.
1047
1048
1049
1050 textbox:
1051 • background-color: color
1052
1053 • border-color: the color used for the border around the
1054 widget.
1055
1056 • font: the font used by this textbox (string).
1057
1058 • str: the string to display by this textbox
1059 (string).
1060
1061 • vertical-align: Vertical alignment of the text. A number
1062 between 0 (top) and 1 (bottom).
1063
1064 • horizontal-align: Horizontal alignment of the text. A number
1065 between 0 (left) and 1 (right).
1066
1067 • text-color: the text color to use.
1068
1069 • highlight: text style {color}. color is optional,
1070 multiple highlight styles can be added like: bold underline
1071 italic #000000; This option is only available on the ele‐
1072 ment-text widget.
1073
1074 • width: override the desired width for the textbox.
1075
1076 • content: Set the displayed text (String).
1077
1078 • placeholder: Set the displayed text (String) when noth‐
1079 ing is entered.
1080
1081 • placeholder-color: Color of the placeholder text.
1082
1083 • blink: Enable/Disable blinking on an input textbox
1084 (Boolean).
1085
1086 • markup: Force markup on, beware that only valid
1087 pango markup strings are shown.
1088
1089 • tab-stops: array of distances Set the location of tab
1090 stops by their distance from the beginning of the line. Each
1091 distance should be greater than the previous one. The text
1092 appears to the right of the tab stop position (other align‐
1093 ments are not supported yet).
1094
1095
1096
1097 listview:
1098 • columns: integer Number of columns to show (at least
1099 1)
1100
1101 • fixed-height: boolean Always show lines rows, even if fewer
1102 elements are available.
1103
1104 • dynamic: boolean True if the size should change when
1105 filtering the list, False if it should keep the original
1106 height.
1107
1108 • scrollbar: boolean If the scrollbar should be en‐
1109 abled/disabled.
1110
1111 • scrollbar-width: distance Width of the scrollbar
1112
1113 • cycle: boolean When navigating, it should wrap
1114 around
1115
1116 • spacing: distance Spacing between the elements (both
1117 vertical and horizontal)
1118
1119 • lines: integer Number of rows to show in the list
1120 view.
1121
1122 • layout: orientation Indicate how elements are
1123 stacked. Horizontal implements the dmenu style.
1124
1125 • reverse: boolean Reverse the ordering (top down to
1126 bottom up).
1127
1128 • fixed-columns: boolean Do not reduce the number of columns
1129 shown when number of visible elements is not enough to fill
1130 them all.
1131
1132
1133
1134 Each element is a box called element. Each element can contain an ele‐
1135 ment-icon and element-text.
1136
1137
1138 listview text highlight:
1139 The element-text widget in the listview is the one used to show the
1140 text. On this widget set the highlight property (only place this prop‐
1141 erty is used) to change the style of highlighting. The highlight prop‐
1142 erty consist of the text-style property and a color.
1143
1144
1145 To disable highlighting:
1146
1147
1148 element-text {
1149 highlight: None;
1150 }
1151
1152
1153
1154 To set to red underlined:
1155
1156
1157 element-text {
1158 highlight: underline red;
1159 }
1160
1161
1162
1164 The new format allows the layout of the rofi window to be tweaked ex‐
1165 tensively. For each widget, the themer can specify padding, margin,
1166 border, font, and more. It even allows, as an advanced feature, to
1167 pack widgets in a custom structure.
1168
1169
1170 Basic structure
1171 The whole view is made out of boxes that pack other boxes or widgets.
1172 The box can be vertical or horizontal. This is loosely inspired by GTK
1173 ⟨http://gtk.org/⟩.
1174
1175
1176 The current layout of rofi is structured as follows:
1177
1178
1179 |------------------------------------------------------------------------------------|
1180 | window {BOX:vertical} |
1181 | |-------------------------------------------------------------------------------| |
1182 | | mainbox {BOX:vertical} | |
1183 | | |---------------------------------------------------------------------------| | |
1184 | | | inputbar {BOX:horizontal} | | |
1185 | | | |---------| |-| |---------------------------------|---| |---| |---| |---| | | |
1186 | | | | prompt | |:| | entry |#fr| | / | |#ns| |ci | | | |
1187 | | | |---------| |_| |---------------------------------|---| |---| |---| |---| | | |
1188 | | |---------------------------------------------------------------------------| | |
1189 | | | |
1190 | | |---------------------------------------------------------------------------| | |
1191 | | | message | | |
1192 | | | |-----------------------------------------------------------------------| | | |
1193 | | | | textbox | | | |
1194 | | | |-----------------------------------------------------------------------| | | |
1195 | | |---------------------------------------------------------------------------| | |
1196 | | | |
1197 | | |-----------------------------------------------------------------------------| |
1198 | | | listview | |
1199 | | | |------------------------------------------------------------------------] | |
1200 | | | | element | | |
1201 | | | | |-----------------| |------------------------------------------------] | | |
1202 | | | | |element-icon | |element-text | | | |
1203 | | | | |-----------------| |------------------------------------------------| | | |
1204 | | | |------------------------------------------------------------------------] | |
1205 | | |-----------------------------------------------------------------------------| |
1206 | | | |
1207 | | |---------------------------------------------------------------------------| | |
1208 | | | mode-switcher {BOX:horizontal} | | |
1209 | | | |---------------| |---------------| |--------------| |---------------| | | |
1210 | | | | Button | | Button | | Button | | Button | | | |
1211 | | | |---------------| |---------------| |--------------| |---------------| | | |
1212 | | |---------------------------------------------------------------------------| | |
1213 | |-------------------------------------------------------------------------------| |
1214 |------------------------------------------------------------------------------------|
1215
1216
1217
1218
1219
1220 • ci is the case-indicator
1221
1222 • fr is the num-filtered-rows
1223
1224 • ns is the num-rows
1225
1226
1227
1228
1229 Error message structure
1230 |-----------------------------------------------------------------------------------|
1231 | window {BOX:vertical} |
1232 | |------------------------------------------------------------------------------| |
1233 | | error-message {BOX:vertical} | |
1234 | | |-------------------------------------------------------------------------| | |
1235 | | | textbox | | |
1236 | | |-------------------------------------------------------------------------| | |
1237 | |------------------------------------------------------------------------------| |
1238 |-----------------------------------------------------------------------------------|
1239
1240
1241
1242
1243
1244 Advanced layout
1245 The layout of rofi can be tweaked by packing the 'fixed' widgets in a
1246 custom structure.
1247
1248
1249 The following widgets are fixed, as they provide core rofi functional‐
1250 ity:
1251
1252
1253 • prompt
1254
1255 • entry
1256
1257 • overlay
1258
1259 • case-indicator
1260
1261 • message
1262
1263 • listview
1264
1265 • mode-switcher
1266
1267 • num-rows
1268
1269 • num-filtered-rows
1270
1271
1272
1273 The following keywords are defined and can be used to automatically
1274 pack a subset of the widgets. These are used in the default theme as
1275 depicted in the figure above.
1276
1277
1278 • mainbox Packs: inputbar, message, listview, mode-switcher
1279
1280 • inputbar Packs: prompt,entry,case-indicator
1281
1282
1283
1284 Any widget name starting with textbox is a textbox widget, others are
1285 box widgets and can pack other widgets.
1286
1287
1288 There are several special widgets that can be used by prefixing the
1289 name of the widget:
1290
1291
1292 textbox
1293 This is a read-only textbox widget. The displayed string can be set
1294 with content.
1295
1296
1297 Example:
1298
1299
1300 textbox-custom {
1301 expand: false;
1302 content: "My Message";
1303 }
1304
1305
1306
1307 Icon
1308 This is an icon widget. The displayed icon can be set with filename and
1309 size with size. If the property action is set, it acts as a button.
1310 action can be set to a keybinding name and completes that action. (see
1311 rofi -show keys for a list).
1312
1313
1314 If the squared property is set to false the widget height and width are
1315 not forced to be equal.
1316
1317
1318 Example:
1319
1320
1321 icon-paste {
1322 expand: false;
1323 filename: "gtk-paste";
1324 size: 24;
1325 vertical-align: 0.5;
1326 action: "kb-primary-paste";
1327 }
1328
1329
1330
1331 button
1332 This is a textbox widget that can have a 'clickable' action. The ac‐
1333 tion can be set to: keybinding: accepts a keybinding name and completes
1334 that action. (see rofi -show keys for a list).
1335
1336
1337 button-paste {
1338 expand: false;
1339 content: "My Clickable Message";
1340 vertical-align: 0.5;
1341 action: "kb-primary-paste";
1342 }
1343
1344
1345
1346 Children
1347 To specify children, set the children property (this always happens on
1348 the box child, see example below):
1349
1350
1351 inputbar {
1352 children: [prompt,entry,overlay,case-indicator];
1353 }
1354
1355
1356
1357 The theme needs to be updated to match the hierarchy specified.
1358
1359
1360 Below is an example of a theme emulating dmenu:
1361
1362
1363 * {
1364 background-color: Black;
1365 text-color: White;
1366 border-color: White;
1367 font: "Times New Roman 12";
1368 }
1369
1370 window {
1371 anchor: north;
1372 location: north;
1373 width: 100%;
1374 padding: 4px;
1375 children: [ horibox ];
1376 }
1377
1378 horibox {
1379 orientation: horizontal;
1380 children: [ prompt, entry, listview ];
1381 }
1382
1383 listview {
1384 layout: horizontal;
1385 spacing: 5px;
1386 lines: 10;
1387 }
1388
1389 entry {
1390 expand: false;
1391 width: 10em;
1392 }
1393
1394 element {
1395 padding: 0px 2px;
1396 }
1397 element selected {
1398 background-color: SteelBlue;
1399 }
1400
1401
1402
1403 Padding and margin
1404 Just like CSS, rofi uses the box model for each widget.
1405
1406
1407 |-------------------------------------------------------------------|
1408 | margin |
1409 | |-------------------------------------------------------------| |
1410 | | border | |
1411 | | |---------------------------------------------------------| | |
1412 | | | padding | | |
1413 | | | |-----------------------------------------------------| | | |
1414 | | | | content | | | |
1415 | | | |-----------------------------------------------------| | | |
1416 | | |---------------------------------------------------------| | |
1417 | |-------------------------------------------------------------| |
1418 |-------------------------------------------------------------------|
1419
1420
1421
1422 Explanation of the different parts:
1423
1424
1425 • Content - The content of the widget.
1426
1427 • Padding - Clears an area around the widget. The padding shows
1428 the background color of the widget.
1429
1430 • Border - A border that goes around the padding and content.
1431 The border use the border-color of the widget.
1432
1433 • Margin - Clears an area outside the border. The margin is
1434 transparent.
1435
1436
1437
1438 The box model allows us to add a border around elements, and to define
1439 space between elements.
1440
1441
1442 The size of each margin, border, and padding can be set. For the bor‐
1443 der, a linestyle and radius can be set.
1444
1445
1446 Spacing
1447 Widgets that can pack more then one child widget (currently box and
1448 listview) have the spacing property. This property sets the distance
1449 between the packed widgets (both horizontally and vertically).
1450
1451
1452 |---------------------------------------|
1453 | |--------| s |--------| s |-------| |
1454 | | child | p | child | p | child | |
1455 | | | a | | a | | |
1456 | | | c | | c | | |
1457 | | | i | | i | | |
1458 | | | n | | n | | |
1459 | |--------| g |--------| g |-------| |
1460 |---------------------------------------|
1461
1462
1463
1464 Advanced box packing
1465 More dynamic spacing can be achieved by adding dummy widgets, for exam‐
1466 ple to make one widget centered:
1467
1468
1469 |----------------------------------------------------|
1470 | |---------------| |--------| |---------------| |
1471 | | dummy | | child | | dummy | |
1472 | | expand: true; | | | | expand: true; | |
1473 | | | | | | | |
1474 | | | | | | | |
1475 | | | | | | | |
1476 | |---------------| |--------| |---------------| |
1477 |----------------------------------------------------|
1478
1479
1480
1481 If both dummy widgets are set to expand, child will be centered. De‐
1482 pending on the expand flag of child the remaining space will be equally
1483 divided between both dummy and child widget (expand enabled), or both
1484 dummy widgets (expand disabled).
1485
1486
1488 To get debug information from the parser, run rofi like:
1489
1490
1491 G_MESSAGES_DEBUG=Parser rofi -show run
1492
1493
1494
1495 Syntax errors are shown in a popup and printed out to command line with
1496 the above command.
1497
1498
1499 To see the elements queried during running, run:
1500
1501
1502 G_MESSAGES_DEBUG=Theme rofi -show run
1503
1504
1505
1506 To test minor changes, part of the theme can be passed on the command
1507 line, for example to set it to full-screen:
1508
1509
1510 rofi -theme-str 'window { fullscreen:true;}' -show run
1511
1512
1513
1514 Another syntax to modify theme properties is:
1515
1516
1517 rofi -theme+window+fullscreen true -show run
1518
1519
1520
1521 To print the current theme, run:
1522
1523
1524 rofi -dump-theme
1525
1526
1527
1529 Parts of the theme can be conditionally loaded, like the CSS @media op‐
1530 tion.
1531
1532
1533 @media ( min-width: 120 ) {
1534
1535 }
1536
1537
1538
1539 It supports the following keys as constraint:
1540
1541
1542 • min-width: load when width is bigger or equal then
1543 value.
1544
1545 • max-width: load when width is smaller then value.
1546
1547 • min-height: load when height is bigger or equal then
1548 value.
1549
1550 • max-height: load when height is smaller then value.
1551
1552 • min-aspect-ratio load when aspect ratio is over value.
1553
1554 • max-aspect-ratio: load when aspect ratio is under value.
1555
1556 • monitor-id: The monitor id, see rofi -help for id's.
1557
1558
1559
1560 @media takes an integer number or a fraction, for integer number px can
1561 be added.
1562
1563
1564 @media ( min-width: 120 px ) {
1565
1566 }
1567
1568
1569
1571 Rofi uses pango ⟨https://pango.gnome.org/⟩ for font rendering. The font
1572 should be specified in a format that pango understands. This normally
1573 is the font name followed by the font size. For example:
1574
1575
1576 mono 18
1577
1578
1579
1580 Or
1581
1582
1583 FontAwesome 22
1584
1585
1586
1588 The rasi file format offers two methods of including other files. This
1589 can be used to modify existing themes, or have multiple variations on a
1590 theme.
1591
1592
1593 • import: Import and parse a second file.
1594
1595 • theme: Discard theme, and load file as a fresh theme.
1596
1597
1598
1599 Syntax:
1600
1601
1602 @import "myfile"
1603 @theme "mytheme"
1604
1605
1606
1607 The specified file can either by name, filename,full path.
1608
1609
1610 If a filename is provided, it will try to resolve it in the following
1611 order:
1612
1613
1614 • ${XDG_CONFIG_HOME}/rofi/themes/
1615
1616 • ${XDG_CONFIG_HOME}/rofi/
1617
1618 • ${XDG_DATA_HOME}/rofi/themes/
1619
1620 • ${INSTALL PREFIX}/share/rofi/themes/
1621
1622
1623
1624 A name is resolved as a filename by appending the .rasi extension.
1625
1626
1628 Several examples are installed together with rofi. These can be found
1629 in {datadir}/rofi/themes/, where {datadir} is the install path of rofi
1630 data. When installed using a package manager, this is usually:
1631 /usr/share/.
1632
1633
1635 rofi(1), rofi-script(5), rofi-theme-selector(1)
1636
1637
1638
1639 rofi-theme ROFI-THEME(5)