<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Reference</title> <link rel="stylesheet" href="../luadoc.css" type="text/css" /> <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/--> </head> <body> <div id="container"> <div id="product"> <div id="product_logo"></div> <div id="product_name"><big><b></b></big></div> <div id="product_description"></div> </div> <!-- id="product" --> <div id="main"> <div id="navigation"> <h1>LuaDoc</h1> <ul> <li><a href="../index.html">Index</a></li> </ul> <!-- Module list --> <h1>Modules</h1> <ul> <li> <a href="../modules/awesome.html">awesome</a> </li> <li> <a href="../modules/awful.html">awful</a> </li> <li> <a href="../modules/awful.autofocus.html">awful.autofocus</a> </li> <li> <a href="../modules/awful.button.html">awful.button</a> </li> <li> <a href="../modules/awful.client.html">awful.client</a> </li> <li> <a href="../modules/awful.completion.html">awful.completion</a> </li> <li> <a href="../modules/awful.dbus.html">awful.dbus</a> </li> <li> <a href="../modules/awful.hooks.html">awful.hooks</a> </li> <li> <a href="../modules/awful.key.html">awful.key</a> </li> <li> <a href="../modules/awful.layout.html">awful.layout</a> </li> <li> <a href="../modules/awful.layout.suit.html">awful.layout.suit</a> </li> <li> <a href="../modules/awful.layout.suit.fair.html">awful.layout.suit.fair</a> </li> <li> <a href="../modules/awful.layout.suit.floating.html">awful.layout.suit.floating</a> </li> <li> <a href="../modules/awful.layout.suit.magnifier.html">awful.layout.suit.magnifier</a> </li> <li> <a href="../modules/awful.layout.suit.max.html">awful.layout.suit.max</a> </li> <li> <a href="../modules/awful.layout.suit.spiral.html">awful.layout.suit.spiral</a> </li> <li> <a href="../modules/awful.layout.suit.tile.html">awful.layout.suit.tile</a> </li> <li> <a href="../modules/awful.menu.html">awful.menu</a> </li> <li> <a href="../modules/awful.mouse.html">awful.mouse</a> </li> <li> <a href="../modules/awful.mouse.finder.html">awful.mouse.finder</a> </li> <li> <a href="../modules/awful.placement.html">awful.placement</a> </li> <li> <a href="../modules/awful.prompt.html">awful.prompt</a> </li> <li> <a href="../modules/awful.remote.html">awful.remote</a> </li> <li> <a href="../modules/awful.rules.html">awful.rules</a> </li> <li> <a href="../modules/awful.screen.html">awful.screen</a> </li> <li> <a href="../modules/awful.startup_notification.html">awful.startup_notification</a> </li> <li> <a href="../modules/awful.tag.html">awful.tag</a> </li> <li> <a href="../modules/awful.titlebar.html">awful.titlebar</a> </li> <li> <a href="../modules/awful.tooltip.html">awful.tooltip</a> </li> <li><strong>awful.util</strong></li> <li> <a href="../modules/awful.wibox.html">awful.wibox</a> </li> <li> <a href="../modules/awful.widget.html">awful.widget</a> </li> <li> <a href="../modules/awful.widget.button.html">awful.widget.button</a> </li> <li> <a href="../modules/awful.widget.common.html">awful.widget.common</a> </li> <li> <a href="../modules/awful.widget.graph.html">awful.widget.graph</a> </li> <li> <a href="../modules/awful.widget.launcher.html">awful.widget.launcher</a> </li> <li> <a href="../modules/awful.widget.layout.html">awful.widget.layout</a> </li> <li> <a href="../modules/awful.widget.layout.default.html">awful.widget.layout.default</a> </li> <li> <a href="../modules/awful.widget.layout.horizontal.html">awful.widget.layout.horizontal</a> </li> <li> <a href="../modules/awful.widget.layout.vertical.html">awful.widget.layout.vertical</a> </li> <li> <a href="../modules/awful.widget.layoutbox.html">awful.widget.layoutbox</a> </li> <li> <a href="../modules/awful.widget.progressbar.html">awful.widget.progressbar</a> </li> <li> <a href="../modules/awful.widget.prompt.html">awful.widget.prompt</a> </li> <li> <a href="../modules/awful.widget.taglist.html">awful.widget.taglist</a> </li> <li> <a href="../modules/awful.widget.tasklist.html">awful.widget.tasklist</a> </li> <li> <a href="../modules/awful.widget.textclock.html">awful.widget.textclock</a> </li> <li> <a href="../modules/beautiful.html">beautiful</a> </li> <li> <a href="../modules/button.html">button</a> </li> <li> <a href="../modules/client.html">client</a> </li> <li> <a href="../modules/dbus.html">dbus</a> </li> <li> <a href="../modules/image.html">image</a> </li> <li> <a href="../modules/key.html">key</a> </li> <li> <a href="../modules/keygrabber.html">keygrabber</a> </li> <li> <a href="../modules/mouse.html">mouse</a> </li> <li> <a href="../modules/mousegrabber.html">mousegrabber</a> </li> <li> <a href="../modules/naughty.html">naughty</a> </li> <li> <a href="../modules/root.html">root</a> </li> <li> <a href="../modules/screen.html">screen</a> </li> <li> <a href="../modules/selection.html">selection</a> </li> <li> <a href="../modules/tag.html">tag</a> </li> <li> <a href="../modules/timer.html">timer</a> </li> <li> <a href="../modules/wibox.html">wibox</a> </li> <li> <a href="../modules/widget.html">widget</a> </li> </ul> <!-- File list --> </div><!-- id="navigation" --> <div id="content"> <h1>Module <code>awful.util</code></h1> <p>Utility module for awful</p> <p><b>Author:</b> <table class="authors_list"> <tr><td class="name">Julien Danjou <julien@danjou.info></td></tr> </table> </p> <p>Copyright© 2008 Julien Danjou</p> <p><small><b>Release:</b> v3.4.9 </small></p> <h2>Functions</h2> <table class="function_list"> <tr> <td class="name" nowrap><a href="#checkfile">checkfile</a> (path)</td> <td class="summary">Check if a file is a Lua valid file.</td> </tr> <tr> <td class="name" nowrap><a href="#color_strip_alpha">color_strip_alpha</a> (color)</td> <td class="summary">Strip alpha part of color.</td> </tr> <tr> <td class="name" nowrap><a href="#cycle">cycle</a> (t, i)</td> <td class="summary">Make i cycle.</td> </tr> <tr> <td class="name" nowrap><a href="#escape">escape</a> (text)</td> <td class="summary">Escape a string from XML char.</td> </tr> <tr> <td class="name" nowrap><a href="#eval">eval</a> (s)</td> <td class="summary">Eval Lua code.</td> </tr> <tr> <td class="name" nowrap><a href="#file_readable">file_readable</a> (filename)</td> <td class="summary">Check if file exists and is readable.</td> </tr> <tr> <td class="name" nowrap><a href="#getdir">getdir</a> (d)</td> <td class="summary">Get the user's config or cache dir.</td> </tr> <tr> <td class="name" nowrap><a href="#linewrap">linewrap</a> (text, width, indent)</td> <td class="summary">Split a string into multiple lines </td> </tr> <tr> <td class="name" nowrap><a href="#mkdir">mkdir</a> (dir)</td> <td class="summary">Create a directory </td> </tr> <tr> <td class="name" nowrap><a href="#pread">pread</a> (cmd)</td> <td class="summary">Read a program output and returns its output as a string.</td> </tr> <tr> <td class="name" nowrap><a href="#restart">restart</a> ()</td> <td class="summary">Try to restart awesome.</td> </tr> <tr> <td class="name" nowrap><a href="#spawn">spawn</a> (cmd, sn, screen)</td> <td class="summary">Spawn a program.</td> </tr> <tr> <td class="name" nowrap><a href="#spawn_with_shell">spawn_with_shell</a> (cmd, screen)</td> <td class="summary">Spawn a program using the shell.</td> </tr> <tr> <td class="name" nowrap><a href="#subsets">subsets</a> (set)</td> <td class="summary">Return all subsets of a specific set.</td> </tr> <tr> <td class="name" nowrap><a href="#table.clone">table.clone</a> (t)</td> <td class="summary">Clone a table </td> </tr> <tr> <td class="name" nowrap><a href="#table.hasitem">table.hasitem</a> (t, item)</td> <td class="summary">Check if a table has an item and return its key.</td> </tr> <tr> <td class="name" nowrap><a href="#table.join">table.join</a> (..., args)</td> <td class="summary">Join all tables given as parameters.</td> </tr> <tr> <td class="name" nowrap><a href="#table.keys">table.keys</a> (t)</td> <td class="summary">Get a sorted table with all integer keys from a table </td> </tr> <tr> <td class="name" nowrap><a href="#table.keys_filter">table.keys_filter</a> (t, ...)</td> <td class="summary">Filter a tables keys for certain content types </td> </tr> <tr> <td class="name" nowrap><a href="#table.reverse">table.reverse</a> (t)</td> <td class="summary">Reverse a table </td> </tr> <tr> <td class="name" nowrap><a href="#unescape">unescape</a> (text)</td> <td class="summary">Unescape a string from entities.</td> </tr> </table> <br/> <br/> <h2><a name="functions"></a>Functions</h2> <dl class="function"> <dt><a name="checkfile"></a><strong>checkfile</strong> (path)</dt> <dd> Check if a file is a Lua valid file. This is done by loading the content and compiling it with loadfile(). <h3>Parameters</h3> <ul> <li> path: The file path. </li> </ul> <h3>Return value:</h3> A function if everything is alright, a string with the error otherwise. </dd> <dt><a name="color_strip_alpha"></a><strong>color_strip_alpha</strong> (color)</dt> <dd> Strip alpha part of color. <h3>Parameters</h3> <ul> <li> color: The color. </li> </ul> <h3>Return value:</h3> The color without alpha channel. </dd> <dt><a name="cycle"></a><strong>cycle</strong> (t, i)</dt> <dd> Make i cycle. <h3>Parameters</h3> <ul> <li> t: A length. </li> <li> i: An absolute index to fit into #t. </li> </ul> <h3>Return value:</h3> The object at new index. </dd> <dt><a name="escape"></a><strong>escape</strong> (text)</dt> <dd> Escape a string from XML char. Useful to set raw text in textbox. <h3>Parameters</h3> <ul> <li> text: Text to escape. </li> </ul> <h3>Return value:</h3> Escape text. </dd> <dt><a name="eval"></a><strong>eval</strong> (s)</dt> <dd> Eval Lua code. <h3>Parameters</h3> <ul> <li> s: </li> </ul> <h3>Return value:</h3> The return value of Lua code. </dd> <dt><a name="file_readable"></a><strong>file_readable</strong> (filename)</dt> <dd> Check if file exists and is readable. <h3>Parameters</h3> <ul> <li> filename: The file path </li> </ul> <h3>Return value:</h3> True if file exists and readable. </dd> <dt><a name="getdir"></a><strong>getdir</strong> (d)</dt> <dd> Get the user's config or cache dir. It first checks XDG_CONFIG_HOME / XDG_CACHE_HOME, but then goes with the default paths. <h3>Parameters</h3> <ul> <li> d: The directory to get (either "config" or "cache"). </li> </ul> <h3>Return value:</h3> A string containing the requested path. </dd> <dt><a name="linewrap"></a><strong>linewrap</strong> (text, width, indent)</dt> <dd> Split a string into multiple lines <h3>Parameters</h3> <ul> <li> text: String to wrap. </li> <li> width: Maximum length of each line. Default: 72. </li> <li> indent: Number of spaces added before each wrapped line. Default: 0. </li> </ul> <h3>Return value:</h3> The string with lines wrapped to width. </dd> <dt><a name="mkdir"></a><strong>mkdir</strong> (dir)</dt> <dd> Create a directory <h3>Parameters</h3> <ul> <li> dir: The directory. </li> </ul> <h3>Return value:</h3> mkdir return code </dd> <dt><a name="pread"></a><strong>pread</strong> (cmd)</dt> <dd> Read a program output and returns its output as a string. <h3>Parameters</h3> <ul> <li> cmd: The command to run. </li> </ul> <h3>Return value:</h3> A string with the program output, or the error if one occured. </dd> <dt><a name="restart"></a><strong>restart</strong> ()</dt> <dd> Try to restart awesome. It checks if the configuration file is valid, and then restart if it's ok. If it's not ok, the error will be returned. <h3>Return value:</h3> Never return if awesome restart, or return a string error. </dd> <dt><a name="spawn"></a><strong>spawn</strong> (cmd, sn, screen)</dt> <dd> Spawn a program. <h3>Parameters</h3> <ul> <li> cmd: The command. </li> <li> sn: Enable startup-notification. </li> <li> screen: The screen where to spawn window. </li> </ul> <h3>Return value:</h3> The awesome.spawn return value. </dd> <dt><a name="spawn_with_shell"></a><strong>spawn_with_shell</strong> (cmd, screen)</dt> <dd> Spawn a program using the shell. <h3>Parameters</h3> <ul> <li> cmd: The command. </li> <li> screen: The screen where to run the command. </li> </ul> </dd> <dt><a name="subsets"></a><strong>subsets</strong> (set)</dt> <dd> Return all subsets of a specific set. This function, giving a set, will return all subset it. For example, if we consider a set with value { 10, 15, 34 }, it will return a table containing 2^n set: { }, { 10 }, { 15 }, { 34 }, { 10, 15 }, { 10, 34 }, etc. <h3>Parameters</h3> <ul> <li> set: A set. </li> </ul> <h3>Return value:</h3> A table with all subset. </dd> <dt><a name="table.clone"></a><strong>table.clone</strong> (t)</dt> <dd> Clone a table <h3>Parameters</h3> <ul> <li> t: the table to clone </li> </ul> <h3>Return value:</h3> a clone of t </dd> <dt><a name="table.hasitem"></a><strong>table.hasitem</strong> (t, item)</dt> <dd> Check if a table has an item and return its key. <h3>Parameters</h3> <ul> <li> t: The table. </li> <li> item: The item to look for in values of the table. </li> </ul> <h3>Return value:</h3> The key were the item is found, or nil if not found. </dd> <dt><a name="table.join"></a><strong>table.join</strong> (..., args)</dt> <dd> Join all tables given as parameters. This will iterate all tables and insert all their keys into a new table. <h3>Parameters</h3> <ul> <li> ...: </li> <li> args: A list of tables to join </li> </ul> <h3>Return value:</h3> A new table containing all keys from the arguments. </dd> <dt><a name="table.keys"></a><strong>table.keys</strong> (t)</dt> <dd> Get a sorted table with all integer keys from a table <h3>Parameters</h3> <ul> <li> t: the table for which the keys to get </li> </ul> <h3>Return value:</h3> A table with keys </dd> <dt><a name="table.keys_filter"></a><strong>table.keys_filter</strong> (t, ...)</dt> <dd> Filter a tables keys for certain content types <h3>Parameters</h3> <ul> <li> t: The table to retrieve the keys for </li> <li> ...: the types to look for </li> </ul> <h3>Return value:</h3> A filtered table with keys </dd> <dt><a name="table.reverse"></a><strong>table.reverse</strong> (t)</dt> <dd> Reverse a table <h3>Parameters</h3> <ul> <li> t: the table to reverse </li> </ul> <h3>Return value:</h3> the reversed table </dd> <dt><a name="unescape"></a><strong>unescape</strong> (text)</dt> <dd> Unescape a string from entities. <h3>Parameters</h3> <ul> <li> text: Text to unescape. </li> </ul> <h3>Return value:</h3> Unescaped text. </dd> </dl> </div> <!-- id="content" --> </div> <!-- id="main" --> <div id="about"> <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> </div> <!-- id="about" --> </div> <!-- id="container" --> </body> </html>