5 guish - A language to make and modify GUIs
11 [\fB-c\fR <code>][\fB-s\fR][\fB-q\fR][\fB-k\fR][\fB-t\fR][\fB-f\fR][\fB-v\fR][\fB-b\fR][\fB-h\fR][<file>][<arguments>]
18 is a language to create and modify GUIs; it can be used to tie different programs together by embedding, or to make simple GUIs.
20 This is version 2.x, which depends just on Xlib as all toolkits have been removed (there are some optional dependencies).
27 read and execute commands from command line.
30 display elements when created.
33 quit when closing last element/window.
36 terminate all external programs when quitting.
39 fallback on tty after reading data from other inputs.
42 show available X11 fonts.
48 show build (compiled in) options.
53 .SH INPUTS AND SOURCES
56 guish reads commands from multiple source sequentially; these source are:
57 command line (with \fB-c\fR option), file, standard input, and if \fB-t\fR option is given, controlling terminal.
58 After reading commands from a source, it tries to switch to another one, and when there are no more sources, it simply stays idle.
60 After executing from file or command line or standard input,
61 then finally it switchs to controlling terminal (if \fB-t\fR option is given)
62 and executes from there.
64 If the file given is a named pipe, then
65 it will be opened in non-blocking mode, allowing to issue
66 commands from the other end of the pipe.
71 Being a command interpreter, guish has a little set of syntax rules.
72 They comprises expressions, commands, quotes and special operators.
73 Generic commands and signals are common to all elements,
74 while there are ones which are specific to each element.
75 A phrase is the execution unit, and ends if
76 the program encounters a newline-like character, or a semicolon (";").
81 Single line comments begin with a \fB#\fR, and end at newline like character:
84 a = 4 # this is a comment
87 Multiline comments instead are embedded inside \fB#[\fR and \fB]#\fR (or
88 end at the end of source):
92 is a multiline comment,
93 ending here. ]# puts "a: @{a}"
96 .SS Elements and element expressions
99 Elements are basically widgets and have some commands and signals associated with them;
100 they can be created using element expressions, enclosing element name within
107 In this example, "|b|" is an expression which creates an element
108 of type button, and returns its X11 window id (ex, "65011718").
110 The \fB+\fR command will then show the button (all elements are hidden by default
111 unless \fB-s\fR option is given).
113 .SS Subject and implied subject
116 To refer to the last created/modified element, you can use
117 it without naming it explicitly, for example:
123 The "+" command will by applied to element created
124 by "|i|" expression automatically.
126 .SS Variables and variable substitution
130 We can refer to elements by using variable substitution, instead of using their window ids:
145 Commands instead can be of three distinct types: special, generic and normal.
147 Special commands are meant to change guish behaviour, generic ones are meant to modify an element of any type and normal ones are for a specific element type (every element can have specialized commands).
153 Signals make it possible to run actions on UI changes (or,
154 more generally, on some events).
160 Here, the user creates a button
161 that when clicked will make guish execute a system command (free in this case)
162 (see \fBrun\fR in SPECIAL COMMANDS).
165 |b|<generator =>c{|b|<clone}
168 A button which is a factory of buttons (run this with \fB-s\fR option).
170 Here the evaluation of the code block is done when
171 the click signal is triggered.
173 .SS Scopes and closures
176 All variables (functions too, as blocks can be assigned to variables) have a specific scope:
184 Here the variable "a" is defined in the global scope, while
185 "b" is defined in a temporarily block scope; hence just "a"
186 is printed to stdout.
188 When accessing reading/defining a variable in a local scope, if
189 the variable is already defined in the enclosing scope
190 then that variable is picked to be read/modified:
201 Here "a" is defined in the global scope, then modified from block scope
202 and printed from there, and its value doesn't change.
204 If a variable is defined inside a block, then
205 all embedded blocks that reference that variable
206 will get its value at definition time (a closure):
217 .SS Quotes, blocks and functions
221 There are single and double quoting: anything embedded inside
222 single quotes '', is treated literally (no escaping takes place) and as a single token.
224 Variable and function interpolations (respectively via "\fB@{...}\fR" and "\fB@(...)\fR")
225 are used inside double quotes "", external command substitution quotes ``
226 and external window id substitution \fB<(...)\fR.
228 Escaping ("\\n\\t\\r\\f\\v\\b") takes place only inside double quotes "".
231 a = 'my string'; puts "this is:\t @{a}"
232 puts "sum of 1 + 5 is: @(add(1, 5))"
235 Anything embedded inside \fB{}\fR is treated as a code block
236 and no variable substitution is done at definition time.
238 To "execute" a block, simply use parens \fB()\fR.
239 If arguments are given, they can be referenced inside block by using \fB@n\fR, where "n" is a number
240 which represents a specific argument by position, with indexes starting at 1 (works with command line parameters too).
241 To refer to all arguments (at once) given to the block use \fB@*\fR operator
242 (when in string interpolation, argument separator is a space).
246 a = {puts "here is @{v}"}
250 Here the variable "v" is not substituted when assigning the block
251 to "a"; it's substituted later, when function "a" is called.
255 puts join("string length is: ", len(@1))
259 Here instead, the block is defined and executed immediately, using "home"
260 as the first argument.
262 Being a block a piece of code, it can be used to define functions
263 by simply being assigned to a variable:
266 fn = {return add(@1, @2)}
267 puts join("my func res:", fn(2, 4))
270 In addition, when defining a new function, it's possible
271 to "overwrite" the builtin functions in the current scope.
273 When returning from a function, instead, it's possible to
274 return multiple arguments (the remaining phrase) to the caller:
284 Anything equal to 0, "0" or empty (like \fB''\fR, \fB""\fR, \fB{}\fR) is false, true otherwise.
285 This is useful with \fBif\fR and \fBelse\fR commands:
288 if 1 { |b|<text } else { |b|<neverhere }
292 if ge(@a,4) { |l|<4 }
295 .SS Loops and iteration
298 Here an example of a \fBwhile\fR loop:
309 And here another one using \fBeach\fR function:
312 each({puts @1}, 1, 2, 3, 4, 5})
315 And another one of a \fBfor\fR loop:
318 for x in 1 2 3 4: { puts @x }
321 .SS Tail recursion optimization (TCO)
324 Since \fB2.2.1\fR version, guish supports tail recursion optimization too,
325 effectively turning a tail recursive function into a loop:
333 return upto(add(@1, 1), @2)
338 To use TCO, the last phrase of a function must use \fBreturn\fF command
339 directly (not inside another block like if-else).
341 .SS External window id substitution
344 Everything inside \fB<( )\fR is recognized as an
345 external command (X11 GUI), forked and executed, and its window id
346 is substituted (using _NET_WM_PID).
348 Note that this method will not work with programs that fork.
356 xterm program is spawn, and can be driven (almost) like
359 .SS External command substitution
362 Everything inside \fB``\fR is recognized as an
363 external command and executed.
364 Then the command output (STDOUT) is substituted inside
365 source code and interpreted after that.
376 Anything inside \fB[]\fR is trated as a slice expression.
377 The usage is \fB[<n>[,<x>]]\fR, when <n> is an index, and <x>
378 is an optional end index (always inclusive); if the preceding
379 argument is a regular token, then the expression will return
380 its characters as specified by index(es), otherwise if it's
381 a block, the expression will return its tokens:
384 puts {1, 2, 3, 4, {a, b}, cat}[4][1]
387 The output of this example is 'b'.
389 If the index(es) given are out of range, an empty token
392 .SH SPECIAL VARIABLES
397 primary screen width, in pixels.
400 primary screen height, in pixels.
409 variable holding the window id when in signal code.
412 refers to the block in which there are positional arguments and
413 function arguments (alternative syntax).
416 variable holding the path of current source file.
419 variable holding current line number at "that" point in source code.
421 .SH ENVIRONMENT VARIABLES
426 the maximum number of seconds to wait when applying external window id substitution
427 (defaults to 3 seconds)
433 Available elements are:
446 A page (container of other elements; show and hide are applied to all subelements).
452 A label with a totally transparent background (requires a compositor).
457 Special commands are not tied to elements, they are like statements.
460 .B => <signal> <subcmd>
461 register a sub-command <subcmd> to run when <signal> triggers.
462 For normal signals (eg. signals tied to elements), there must
463 exist an implied subject.
466 unregister a sub-command <subcmd> previously registered on signal <signal>.
469 quit guish (exit status 0).
472 quit guish (exit status <status>).
475 change current working directory using <path>.
478 execute shell command <cmd>.
481 prints remaining phrase to stdout with a newline added.
484 prints remaining phrase to stdout.
487 prints remaining phrase to stderr.
489 .B unset <name|num|wid> [<attr>]
490 unsets a variable (<name>) or timed scheduled procedure registered with <num>, see
493 If, instead of <name|num>, an element id <wid> is given and
494 a name attribute <attr> is given, deletes that element attribute.
497 execute commands from file.
500 shows all variables present in the current scope or,
501 if <wid> element id is given, shows all element attributes
505 display all existing widgets (stderr).
508 delete a widget with id <wid>.
510 .B every <seconds> <block>
511 schedule <code> to run after <seconds> seconds are elapsed.
513 .B after <seconds> <block>
514 schedule <block> to run once after <seconds> seconds are elapsed.
517 stop command execution and wait <seconds> seconds before resuming (accepts decimal values too).
518 XEvent handling, schedules actions and signal execution are unaffected by this option.
520 .B if <condition> <block>
521 executes <block> if condition evaluates to true (see Conditionals).
523 .B unless <condition> <block>
524 executes <block> if condition evaluates to false (see Conditionals).
527 executes <block> if last conditional command was successful (see Conditionals).
530 when used inside a function, returns all its arguments (the remaining phrase)
533 .B while <condition> <block>
534 executes <block> until <condition> evaluates to true (see Conditionals).
536 .B until <condition> <block>
537 executes <block> until <condition> evaluates to true (see Conditionals).
539 .B for [<var1>, <var2>, ...] in [<val1>, <val2>, ...] : <block>
540 executes the block <block> for each group of variables.
543 exit from current loop.
545 .B rel <element1> <element2> <alignment>
546 relates <element1> to <element2>, moving <element1> near <element2> using <alignment> (see alignment in STYLE AND ATTRIBUTES
547 section, as <alignment> opts are similar) every time <element2> is moved.
548 If "0" is specified as alignment, the relation is deleted.
551 do nothing, consuming remaining arguments.
553 .B send <wid> <keysequence>
554 send a keysequence to an element whose id si <wid> (must be enabled at compilation time).
556 .B ctrl <wid> <keysequence>
557 send control key sequence to an element whose id si <wid> (must be enabled at compilation time).
562 Generic commands are applicable to any element, regardless
563 of its type (there are exceptions though).
567 element is undetectable in taskbar.
570 resize the element to fit the entire screen.
573 restore element's default window attributes.
576 bypass window manager.
579 follow window manager as default.
582 center element in its parent.
597 make element stay at top.
600 make element stay at bottom.
603 hide element, or quit guish if quit-on-last-close is on and the element is the last closed one.
612 maximize the element.
621 fits element's size to its content.
624 resize an element in right-bottom directions to fit its parent, respecting limits of other elements.
627 resize an element in right-bottom directions to fit its parent.
630 resize an element in right direction to fit its parent, respecting limits of other elements.
633 resize an element in right direction to fit its parent.
636 resize an element in bottom direction to fit its parent, respecting limits of other elements.
639 resize an element in bottom direction to fit its parent.
642 clear element's data.
648 set element style (see STYLE AND ATTRIBUTES section).
651 resize element by width and height.
654 move element to coords <x> <y>.
656 .B / [<l|L|a|A|p|x|n> [<...>]]
657 draws/fills lines, points and arcs depending on operation (See Drawing operations subsection).
658 Origin coordinates correspond to the bottom-left corner as default Cartesian axes
659 (instead of upper-left one used for windows/elements).
660 If no operation is given, then all drawings are discarded from the implied element.
662 .B A <element> <alignment>
663 moves implied element to <element> using <alignment> (see alignment in STYLE
664 AND ATTRIBUTES section, as <alignment> opts are similar).
667 set element text using <text>.
670 add additional text to element text using <text>.
673 define a variable named <var> using element text to set its value.
676 enable/disable (toggle) moving the parent of the element by click-and-drag it.
677 Enabling this will automatically exclude x/y moving flags below.
680 enable/disable (toggle) moving an element inside its parent by click-and-drag on x axis
681 Enabling this will automatically exclude the flag to click-and-drag and move parent.
684 enable/disable (toggle) moving an element inside its parent by click-and-drag on y axis
685 Enabling this will automatically exclude the flag to click-and-drag and move parent.
687 .SS Drawing operations
692 .B l [<color> <x1> <y1> <x2> <y2> [<...>]]
693 draws lines between given points using color <color> (beware this command consumes all the phrase).
694 If no arguments are given, then all element lines are discarded.
696 .B L [<color> <x1> <y1> <x2> <y2> [<...>]]
697 fills the polygon described by given points using color <color> (beware this command consumes all the phrase).
698 If no arguments are given, then all filled polygons are discarded.
700 .B a [<color> <x> <y> <w> <h> <alpha> <beta> [<...>]]
701 draws an arc using color <color> and whose "center" is at <x> <y>, major and minor axes are respectively
702 <w> and <h>, start and stop angles are <alpha> and <beta> (consumes all the phrase).
703 If no arguments are given, then all element arcs are discarded.
705 .B A [<color> <x> <y> <w> <h> <alpha> <beta> [<...>]]
706 fills an arc using color <color> and whose "center" is at <x> <y>, major and minor axes are respectively
707 <w> and <h>, start and stop angles are <alpha> and <beta> (consumes all the phrase).
708 If no arguments are given, then all element arcs are discarded.
710 .B p [<color> [<...>]]
711 draws given points using color <color> (beware this command consumes all the phrase).
712 If no arguments are given, then all points are discarded.
714 .B x [<color> [<...>]]
715 draws given pixels using color <color> (beware this command consumes all the phrase).
716 If no arguments are given, then all pixels are discarded.
718 .B n [<color> <name> <x> <y>]
719 draws given point using color <color> and putting the text <name> at that point.
720 If no arguments are given, then all points are discarded.
726 .SS checkbox commands
737 show input data as normal while typing.
740 hide input data while typing.
743 use password mode, displaying just asterisks.
746 toggles "go to the next line" when hitting return (triggers return signal anyway).
751 make subelements equals (in size).
754 style all subelements.
757 free all embedded elements.
760 embeds element (or an external client).
763 embeds element (or an external client), fitting the page to its content.
766 free element, reparenting it to root window.
769 free element, reparenting it to root window and fitting the page to its content.
772 set vertical layout readjusting all subwidgets.
775 set horizontal layout readjusting all subwidgets.
778 swaps sub-elements position.
781 inverts the order of sub-elements.
788 Special signals are independent from elements, and are tied to internal guish events.
792 triggered at program exit.
795 triggered when program receives a SIGINT or a SIGTERM.
802 Generic signals are common to all elements.
806 triggered when element is closed.
809 triggered when element is clicked.
812 triggered when element is left-clicked.
815 triggered when element is right-clicked.
818 triggered when element is middle-clicked.
821 triggered when element is double clicked.
824 triggered when element is double left-clicked.
827 triggered when element is double right-clicked.
830 triggered when element is double middle-clicked.
833 triggered when element is pressed.
836 triggered when element is left-pressed.
839 triggered when element is right-pressed.
842 triggered when element is middle-pressed.
845 triggered when element is released.
848 triggered when element is left-released.
851 triggered when element is right-released.
854 triggered when element is middle-released.
857 triggered when element is moved.
860 triggered when element scrolled down.
863 triggered when element scrolled up.
866 triggered when element is resized.
869 triggered when mouse pointer "enters" the element.
872 triggered when mouse pointer "leaves" the element.
875 triggered when focusing the element.
878 triggered when un-focusing the element.
885 Normal signals are per element.
891 triggered when checkbox is unchecked.
894 triggered when checkbox is checked.
899 triggered when input has focus and "return" is hit.
904 These tokens are ignored: "\fB,\fR", "\fB->\fR".
906 .SH EVALUATION ORDER AND SUBSTITUTIONS
910 Every time a new phrase is evaluated, it goes through
911 a series of special substitutions/evaluations before it's commands
914 The evaluation order is: hex substitution (at tokenizer level), evaluation of expressions
915 (where code evaluation/execution, substitutions and functions are computed),
916 evaluation of special commands and execution of generic/normal commands.
918 Moreover if after the execution phase (the last one) the phrase is not empty,
919 the evaluation cycle will restart from evaluation of expressions phase,
920 and it will continue until there are no more tokens in the phrase.
922 Every phrase is reduced to an empty phrase while evaluating:
925 a=234;{i1=|i|;<'input1'+}();{i2=|i|;<'input2'+}()|b|<btn+
928 This example is composed by 2 phrases, and
929 the code block in each phrase is executed before each assignment.
935 Non quoted tokens are subject to hex substitution: if a "\\x" plus 2 hexadecimal characters is found, it's substituted with corresponding ascii characters.
938 puts \\x68\\x6F\\x6D\\x65
941 Here, the string "home" is printed.
946 If a "\fB*\fR" is given, then all widgets wids are
954 .SS Variable substitution
957 With the \fB=\fR operator (actually, it's a special statement command), it's possible
958 to assign values to a variable, reusing it later by simply referencing it
959 using \fB@\fR operator when not inside quotes or by wrapping it
960 inside \fB@{}\fR when in double quotes, shell command substitution quotes \fB``\fR,
961 or external window id substitution \fB<( )\fR.
967 There are two methods to define/create empty variables: by explicitely assing
968 an empty string to a variable (ex. a = "") or by simply omit the
971 In addition, if there is more than one value to assign, a block is automatically
972 created (embedding those values) and assigned to that variable:
975 a = 1 # this simply assigns '1' to the variable 'a'
976 b = 1, 2, 3, 4 # this instead assigns the block '{1, 2, 3, 4}' to the variable 'a'
977 c = {1, 2, 3, 4} # same but explicit
980 Each block has it's own scope, and variable resolution works by searching from
981 the last scope to the first.
995 In the last example, a is set to 1 and printed, then it's
996 changed to 345 from another scope, in which another variable
998 After code block, just "a" is updated, and "b" doesn't exist anymore.
1003 gname = MY_GRIP_NAME
1010 gname = MY_GRIP_NAME
1011 name = 'random name'
1012 puts "@{gname} is maybe @{name}"
1015 .SS Element expressions
1019 Anything inside \fB||\fR is an element expression; a widget of a given
1020 element is created and its X11 window id substituted.
1021 The synopsis is: |<element>[{<width>, <height>}]|
1028 If an integer is given, instead of one of available element types, then the program tries to find an existing program having that integer as window id.
1035 This creates a widget ("external") for the external program and hides it.
1037 .SS Shell command substitution
1041 Anything inside \fB``\fR is treated as a shell
1042 command, and it's output is substituted.
1049 .SS External window id substitution
1052 Everything inside \fB<( )\fR is recognized as an
1053 external command (X11 GUI), forked and executed, and its window id
1054 is substituted (using _NET_WM_PID).
1062 xterm program is spawn, and can be driven (almost) like
1073 returns integers starting at <s> and ending at <e> (inclusive)
1076 .B <var> = [<val>, [<val1>, ...]]
1077 defines a variable (consumes all the phrase).
1078 If no value is given, an empty token is assigned to the variable.
1079 If a single value is given, that value is assigned to the variable.
1080 If multiple values are given, then all these values are wrapped
1081 inside a block, and this block is assigned to the variable.
1083 .B <attr> .= [<val>, [<val1>, ...]]
1084 defines an element using the implied subject attribute (consumes all the phrase).
1085 If no value is given, an empty token is assigned to the variable.
1086 If a single value is given, that value is assigned to the variable.
1087 If multiple values are given, then all these values are wrapped
1088 inside a block, and this block is assigned to the variable.
1095 dereferences a variable name (or positional argument).
1098 returns all function parameters as tokens (usable with command line parameters too).
1101 dereferences an element attribute; if <eid> is given, uses
1102 that element, otherwise uses implied subject.
1106 .SH ELEMENT ATTRIBUTES
1110 Every element can have some default readonly attributes and a
1111 variable number of custom attributes (which can be set by using assignment
1112 only, not by using \fBlet\fR function). To set an attribute, use
1113 the "\fB.=\fR" operator; to get it instead use the "\fB.\fR" operator.
1116 b = |b|; myattr .= 'here'; puts(@b.myattr)
1119 In the last example, a custom attribute, "myattr" is
1122 The following are default attributes (readonly):
1140 widget's border width.
1143 widget's margin width.
1152 widget's checked/unchecked status (only for checkbox).
1155 widget's number of subwidgets (only for page).
1158 widget's subwidgets ids (one token each, only for page).
1161 process ID associated with the widget.
1167 widget is enabled (freezed/unfreezed).
1172 .SH BUILTIN FUNCTIONS
1175 Symbol "\fB...\fR" means a variable number of arguments.
1179 returns 1 if a widget with id <eid> exists, 0 otherwise.
1182 reads and returns a line (excluding newline) from standard input;
1183 if an existing file is given, reads and returns all its content.
1184 Beware that this function blocks the GUI events, and returns nothing
1185 when reading from stdin and source is non-blocking.
1187 .B write(<text>, <file>)
1188 writes text into file and returns the number of characters written.
1189 Creates the file if it doesn't exist yet.
1191 .B append(<text>, <file>)
1192 append text to the end of file and returns the number of characters written.
1193 Creates the file if it doesn't exist yet.
1196 evaluates code by first stringifying all given arguments
1197 and then returns the result of evaluation if any.
1198 Beware that this function runs in the "current" scope,
1201 .B builtin(<func>, ...)
1202 gets the name of a builtin function and a variable number of arguments, then calls
1203 the builtin function with those arguments and returns the result (if any).
1204 It's useful when overriding builtin functions.
1206 .B each(<function>, ...)
1207 executes <function> for each additional argument given passing it as the
1208 first argument to the block. If return values are present, they
1209 will be accumulated and then returned.
1212 returns the value of the environment variable "var".
1215 returns the value of the current working directory.
1217 .B rev([<block>], ...)
1218 if a block is given as first argument, its element will be
1219 returned in reverse, otherwise \fBrev\fR will return all its arguments in reverse.
1220 This function is somewhat special, as when there are no arguments to get,
1221 it'll return nothing (statement behaviour).
1223 .B let([<var>, <val>], ...)
1224 sets variables, works exactly like assignment with special operator \fB=\fR,
1225 but in expressions. This function is somewhat special, it'll return nothing (statement behaviour).
1227 .B if(<cond>, [<v1>, [<v2>]])
1228 if <cond> is true and <v1> is given, returns <v1>, else if <cond> is false and <v2> is given,
1231 .B unless(<cond>, [<v1>, [<v2>]])
1232 if <cond> is false and <v1> is given, returns <v1>, else if <cond> is true and <v2> is given,
1236 returns the first true argument; if there are no true
1237 arguments, returns the last one which is false.
1238 The function evaluates any block given.
1241 returns the last true argument if all arguments are true, otherwise
1242 returns the first false argument.
1243 The function evaluates any block given.
1246 returns all given arguments; if a block is found, then it is flatted.
1249 returns a code block, embedding the given arguments into \fB{\fR\fB}\fR.
1252 returns given arguments. If nothing is given, returns an empty token.
1255 prints given arguments to stdout.
1256 This function is somewhat special, it'll return nothing (statement behaviour).
1259 pushes given arguments to current function arguments (works with command line parameters too).
1260 This function is somewhat special, it'll return nothing (statement behaviour).
1263 pushes given arguments to current function arguments from the beginning (works with command line parameters too).
1264 This function is somewhat special, it'll return nothing (statement behaviour).
1267 pops the last argument from function arguments (works with command line parameters too).
1268 This function is somewhat special, as if there are no arguments to pop,
1269 it'll return nothing (statement behaviour).
1272 pops the first argument from function arguments (works with command line parameters too).
1273 This function is somewhat special, as if there are no arguments to pop.
1275 .B times(<n>, <arg>)
1276 returns a sequence of tokens made by <n> times <arg>.
1277 This function is somewhat special, as when there are 0 tokens to replicate,
1278 it'll return nothing (statement behaviour).
1281 returns the value of the variable with name <name>, or an empty
1282 token if the variable does not exist.
1285 returns 1 if <arg> is true, 0 otherwise.
1288 returns 0 if <arg> is true, 1 otherwise.
1291 returns 1 if <n> is found in <heap>, 0 otherwise;
1292 the arguments can be of any type (single tokens and blocks).
1295 joins blocks and/or tokens by applying the following rules to
1296 all arguments given, and accumulates the result as the first operand.
1297 If the operands are blocks, then a single new block is created by joining them;
1298 if the operands are tokens, then a single new token is created by joining them,
1299 and its type will be that of the "second" token; if the operands are mixed
1300 (eg. a block and a token), then the token will be embedded inside the block.
1303 returns 1 if <token> is a variable, 0 otherwise.
1306 returns 1 if <token> is a (type) variable, 0 otherwise.
1309 returns 1 if <token> refers to a function, 0 otherwise.
1312 returns 1 if just one argument is given and is a block, 0 otherwise.
1315 returns 1 if just one argument is given and is an integer, 0 otherwise.
1318 if a block is given, returns the number of its element, otherwise returns
1319 the number of characters of the token.
1321 .B split(<token>, <sep>)
1322 splits "token" using separator "sep" and returns resulting tokens
1323 having their type equal to that of "token".
1325 .B csplit(<token>, <sep>)
1326 splits "token" using separator "sep" and returns resulting tokens
1329 .B seq(<t1>, <t2>, ...)
1330 returns 1 if all arguments are equal (string comparison), 0 otherwise.
1336 perform subtraction.
1339 perform multiplication
1348 returns a random positive integer.
1351 returns the square root of <n>.
1354 returns the cube root of <n>.
1357 returns the power of <n> raised to <e>.
1360 returns the base 10 logarithm of <n>.
1363 returns the natural logarithm of <n>.
1366 returns the sine of <n> (degrees).
1369 returns the cosine of <n> (degrees).
1372 returns the tangent of <n> (degrees).
1375 returns <n> in its hexadecimal representation.
1378 returns integral part of given number <n>; rounds to nearest integer.
1380 .B xor(<n1>, <n2>, ...)
1381 perform bitwise XOR.
1383 .B band(<n1>, <n2>, ...)
1384 perform bitwise AND.
1386 .B bor(<n1>, <n2>, ...)
1389 .B lsh(<n1>, <n2>, ...)
1390 perform bitwise left shift.
1392 .B rsh(<n1>, <n2>, ...)
1393 perform bitwise right shift.
1398 .B eq(<n1>, <n2>, ...)
1401 .B ne(<n1>, <n2>, ...)
1404 .B lt(<n1>, <n2>, ...)
1407 .B gt(<n1>, <n2>, ...)
1410 .B le(<n1>, <n2>, ...)
1413 .B ge(<n1>, <n2>, ...)
1417 perform absolute value
1422 .SH STYLE AND ATTRIBUTES
1425 Each element has some properties/attributes which can be set by using style command. This command takes a string that has
1429 |l| s 'bg: blue; fg: white'
1432 Here, we create a label with a blue background and white foreground.
1434 Each field must be separated by newlines, \fB;\fR or \fB|\fR.
1435 Colors can be specified by using a common shortname, such as "yellow", or by using RGB value, such as "#ff32ae".
1438 .B background | bg: <color|/<path to image>>
1439 set background color or a background image by specifying image path;
1440 if the string "null" is given as <path to image>, current image is
1441 removed. (Background image loading requires building guish with Imlib2 support.)
1443 .B color | foreground | fg: <color>
1444 set foreground color
1446 .B pressed-background | pbg: <color>
1447 background color when element is pressed
1449 .B pressed-color | pfg: <color>
1450 foreground color when element is pressed
1452 .B hovered-background | hbg: <color>
1453 background color when element is hovered
1455 .B hovered-color | hfg: <color>
1456 foreground color when element is hovered
1458 .B border-color | bc: <color>
1461 .B width | w: <value in pixels>
1464 .B height | h: <value in pixels>
1467 .B border | b: <value in pixels>
1470 .B line | l: <value in pixels>
1471 set line width (use with "/" command)
1473 .B margin | g: <value in pixels>
1476 .B mode | m: <expanding mode>
1477 set expanding mode type (See Expanding mode)
1479 .B align | a: <alignment>
1480 set alignment type (See Alignment)
1482 .B f | font: <font name>
1483 set font type using a X11 font name
1490 width and height are fixed (default for all elements)
1493 width is fixed, height can change
1496 height is fixed, width can change
1499 width and height can change
1504 Any element that's not a page has a particular text alignment
1505 that can be changed.
1506 If an alignment is specified for a page element instead,
1507 (whose defaults alignments are top-center for horizontal
1508 layout, and middle-left for vertical one),
1509 then its sub-elements will be aligned accordingly, depending from page
1513 .B l | left | middle-left
1514 show text at middle left
1516 .B r | right | middle-right
1517 show text at middle right
1519 .B c | center | middle-center
1520 show text at middle center
1523 show text at top left
1526 show text at top right
1529 show text at top center
1532 show text at bottom left
1534 .B br | bottom-right
1535 show text at bottom right
1537 .B b | bottom-center
1538 show text at bottom center
1543 Francesco Palumbo <phranz@subfc.net>
1548 La vera Napoli, Carme, Pico, Titina, Molly, Leo, i miei amati nonni,
1549 mio padre, mia madre, e tutti coloro su cui ho potuto e posso contare.