All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 Author: Luke Bonham <dada [at] archlinux [dot] info>
6 Source: https://github.com/copycat-killer/vain
12 **Please note**: until release version, this documentation will be not updated.
17 Based on a port of [awesome-vain](https://github.com/vain/awesome-vain), this
18 costantly evolving module provides new layouts, a set of widgets and
19 utility functions in order to improve Awesome usability and configurability.
21 This work is licensed under [GNU GPLv2 License](http://www.gnu.org/licenses/gpl-2.0.html).
25 Simply clone this repository into your Awesome directory.
33 Show the current system load in a textbox. Read it directly from
36 mysysload = vain.widgets.systemload()
38 A click on the widget will call `htop` in your `terminal`.
40 The function takes a table as an optional argument. That table may
43 * `.refresh_timeout`: Default to 10 seconds.
44 * `.show_all`: Show all three values (`true`) or only the first one (`false`). Default to `false`.
45 * `.color`: Default to beautiful.bg_normal or "#FFFFFF".
50 Shows the average CPU usage percent for a given amount of time.
52 mycpuusage = vain.widgets.cpu()
54 A click on the widget will call `htop` in your `terminal`.
56 The function takes a table as optional argument, which can contain:
58 Variable | Meaning | Type | Default
60 `refresh_timeout` | Refresh timeout seconds | int | 10
61 `header` | Text to show before value | string | " Vol "
62 `header_color` | Header color | string | `beautiful.fg_normal` or "#FFFFFF"
63 `color` | Value color | string | `beautiful.fg_focus` or "#FFFFFF"
64 `footer` | Text to show after value | string | "%"
66 **Note**: `footer` color is `color`.
71 Show used memory and total memory in MiB.
73 mymem = vain.widgets.mem()
76 The function takes a table as an optional argument. That table may
79 Variable | Meaning | Type | Default
81 `refresh_timeout` | Refresh timeout seconds | int | 10
82 `show_swap` | Show amount of used swap space? | boolean | false
83 `show_total` | Show amout of total memory? | boolean | false
84 `header` | Text to show before value | string | " Vol "
85 `header_color` | Header color | string | `beautiful.fg_normal` or "#FFFFFF"
86 `color` | Value color | string | `beautiful.fg_focus` or "#FFFFFF"
87 `footer` | Text to show after value | string | "MB"
89 **Note**: `footer` color is `color`.
93 Checks maildirs and shows the result in a textbox.
94 Maildirs are structured as follows:
110 therefore `mailcheck` checks whether there are files in the `new`
111 directories. To do so, it calls `find`. If there's new mail, the textbox
112 will say something like "mail: bugs(3), system(1)", otherwise it says
115 mymailcheck = vain.widgets.mailcheck("/path/to/my/maildir")
117 The function takes a table as an optional argument. That table may
120 * `.mailprogram`: Your favourite mail program. Clicking on the widget will
121 spawn it. Default is `mutt`.
122 * `.refresh_timeout`: Default to 60 seconds.
123 * `.mailpath`: Path to your maildir, default is `~/Mail`.
124 * `.ignore_boxes`: Another table which lists boxes (just the last part,
125 like `lists`) to ignore. Default to an empty table.
126 * `.initial_update`: Check for mail when starting Awesome (`true`) or
127 wait for the first refresh timeout (`false`)? Default to `false`.
128 * `.header_text`: Text to show along with output, default is "Mail".
129 * `.header_text_color`: Default to "#9E9E9E".
130 * `.color_newmail`: Default to "#D4D4D4".
131 * `.color_nomail`: Default to "#9E9E9E".
132 * `.shadow`: Hides widget when there are no mails. Default is `false`.
137 Check new mails over imap protocol.
143 Since [luasec](https://github.com/brunoos/luasec/) is still not officially
144 supported in lua 5.2, writing a pure lua solution would have meant too many
145 hacks and dependencies, resulting in a very big and not efficient-proven submodule.
147 That's why I chose Python.
149 Python offers [imaplib](http://docs.python.org/2/library/imaplib.html), a simple yet powerful IMAP4 client library which provides encrypted communication over SSL sockets.
151 Basically, `imapcheck` calls ``vain/scripts/checkmail`` and parse its output in a widget. New mails are also notified through Naughty, with a popup like this:
153 +---------------------------------------------------+
155 | |\ /| donald@disney.org has 3 new messages |
157 | Latest From: Mickey Mouse <boss@disney.org> |
158 | Subject: Re: Vacation Day |
160 | Not after what you did yesterday. |
161 | Daisy told me everything [...] |
163 +---------------------------------------------------+
165 Text will be cut if the mail is too long.
167 myimapcheck = vain.widgets.mailcheck(args)
169 The function takes a table as argument. Required table parameters are:
171 * `.server`: You email server. Example: `imap.gmail.com`.
172 * `.mail`: Your email.
173 * `.password`: Your email password.
175 while the optional are:
177 * `.port`: Imap port. Default is `993`.
178 * `.refresh_timeout`: Default to 60 seconds.
179 * `.notify_timeout`: Notification timeout. Default to 8 seconds.
180 * `.notify_position`: Notification position. Default is "top_left". Check
181 [Naughty position parameter](http://awesome.naquadah.org/doc/api/modules/naughty.html) for a list of other possible values.
182 * `.mailprogram`: Your favourite mail program. Clicking on the widget will
183 spawn it. Default is `mutt`.
184 * `.mail_encoding`: If you wish to set an encoding. Default is `nil`.
185 * `.initial_update`: Check for mail when starting Awesome (`true`) or
186 wait for the first refresh timeout (`false`)? Default to `false`.
187 * `.header_text`: Text to show along with output, default is "Mail".
188 * `.header_text_color`: Default to "#9E9E9E".
189 * `.color_newmail`: Default to "#D4D4D4".
190 * `.color_nomail`: Default to "#9E9E9E".
191 * `.shadow`: Hides widget when there are no mails. Default is `false`.
192 * `.maxlen`: Maximum mail length. If mail is longer, it will be cut. Default is
194 * `.is_plain`: Define whether `.password` field is a plain password (`true`) or a function that retrieves it (`false`). Default to `false`.
196 Let's focus better on `.is_plain` parameter.
198 You can just easily set your password like this:
200 args.is_plain = false
201 args.password = "mypassword"
203 and you'll have the same security provided by `~/.netrc`. (In this case, it's
204 better to set your `rc.lua` permissions to 700 or 600)
206 **Or**, you can use a keyring, like gnome's:
208 args.password = "gnome-keyring-query get password"
210 (`gnome-keyring-query` is not in gnome-keyring pkg, you have to download it
213 or the very light [python keyring](https://pypi.python.org/pypi/keyring).
215 When `.is_plain` is `false`, it *executes* `.password` before using it, so you can also use whatever password fetching solution you want.
217 You can also define your icon for the naughty notification. Just set `vain_mail_notify` into your ``theme.lua``.
224 Provides a `table` with 2 elements:
226 * `table["widget"]` is a textbox displaying current song in play.
228 * `table["force"]` is a function to *force* the widget to update, exactly
229 like `vicious.force()`.
231 Also, a notification is shown when a new song is playing.
239 mpdwidget = vain.widgets.mpd()
241 right_layout:add(mpdwidget["widget"])
243 The function takes a table as an optional argument. That table may
246 * `.password`: Mpd password. Default is unset.
247 * `.host`: Mpd host. Default is "127.0.0.1" (localhost).
248 * `.port`: Mpd port. Default is "6600".
249 * `.music_dir`: Your music directory. Default is "~/Music". If you have to
250 change this, be sure to write the absolute path.
251 * `.refresh_timeout`: Widget refresh timeout. Default is `1`.
252 * `.notify_timeout`: Notification timeout. Default is `5`.
253 * `.color_artist`: Artist name color. Default is `#9E9E9E`.
254 * `.color_song`: Song name color. Default is `#EBEBFF`.
255 * `.musicplr`: Your favourite music player. Clicking on the widget will spawn
256 it. Default is `ncmpcpp`.
257 * `.shadow`: Hides widget when no song is playing. Default is `false`.
259 You can use `table["force"]` to make your mpd keybindings immediate.
262 globalkeys = awful.util.table.join(
265 awful.key({ altkey, "Control" }, "Up", function ()
266 awful.util.spawn_with_shell( "mpc toggle || ncmpcpp toggle || ncmpc toggle || pms toggle", false )
269 awful.key({ altkey, "Control" }, "Down", function ()
270 awful.util.spawn_with_shell( "mpc stop || ncmpcpp stop || ncmpc stop || pms stop", false )
273 awful.key({ altkey, "Control" }, "Left", function ()
274 awful.util.spawn_with_shell( "mpc prev || ncmpcpp prev || ncmpc prev || pms prev", false )
277 awful.key({ altkey, "Control" }, "Right", function ()
278 awful.util.spawn_with_shell( "mpc next || ncmpcpp next || ncmpc next || pms next", false )
285 Monitors network interfaces and shows current traffic in a textbox. If
286 the interface is not present or if there's not enough data yet, you'll
287 see `wlan0: -` or similar. Otherwise, the current traffic is shown in
288 kilobytes per second as `eth0: ↑(00,010.2), ↓(01,037.8)` or similar.
290 neteth0 = vain.widgets.net()
292 The function takes a table as an optional argument. That table may
295 * `.iface`: Default to `eth0`.
296 * `.refresh_timeout`: Default to 2 seconds.
297 * `.color`: Default to beautiful.bg_normal or "#FFFFFF".
302 This is an integration of [gitodo](https://github.com/vain/gitodo) into
305 todolist = vain.widgets.gitodo()
307 The function takes a table as an optional argument. That table may
310 * `.refresh_timeout`: Default to 120 seconds.
311 * `.initial_update`: Check for todo items when starting Awesome (`true`)
312 or wait for the first refresh timeout (`false`)? Default to `true`.
314 `beautiful.gitodo_normal` is used as the color for non-outdated items,
315 `beautiful.gitodo_warning` for those items close to their deadline and
316 `beautiful.gitodo_outdated` is the color of outdated items.
323 I'll only explain the more complex functions. See the source code for
326 menu\_clients\_current\_tags
327 ----------------------------
329 Similar to `awful.menu.clients()`, but this menu only shows the clients
330 of currently visible tags. Use it like this:
332 globalkeys = awful.util.table.join(
334 awful.key({ "Mod1" }, "Tab", function()
335 awful.menu.menu_keys.down = { "Down", "Alt_L", "Tab", "j" }
336 awful.menu.menu_keys.up = { "Up", "k" }
337 vain.util.menu_clients_current_tags({ width = 350 }, { keygrabber = true })
345 Set a client to floating and resize it in the same way the "magnifier"
346 layout does it. Place it on the "current" screen (derived from the mouse
347 position). This allows you to magnify any client you wish, regardless of
348 the currently used layout. Use it with a client keybinding like this:
350 clientkeys = awful.util.table.join(
352 awful.key({ modkey, "Control" }, "m", vain.util.magnify_client),
356 If you want to "de-magnify" it, just reset the clients floating state to
357 `false` (hit `Mod4`+`CTRL`+`Space`, for example).
359 niceborder\_{focus, unfocus}
360 ----------------------------
362 By default, your `rc.lua` contains something like this:
364 client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
365 client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
367 You can change it to this:
369 client.connect_signal("focus", vain.util.niceborder_focus(c))
370 client.connect_signal("unfocus", vain.util.niceborder_unfocus(c))
372 Now, when a client is focused or unfocused, Awesome will look up its
373 nice value in `/proc/<pid>/stat`. If it's less than 0, the client is
374 classified as "high priority"; if it's greater than 0, the client is
375 classified as "low priority". If it's equal to 0, nothing special
378 This requires to define additional colors in your `theme.lua`. For example:
380 theme.border_focus_highprio = "#FF0000"
381 theme.border_normal_highprio = "#A03333"
383 theme.border_focus_lowprio = "#3333FF"
384 theme.border_normal_lowprio = "#333366"
387 ------------------------------
389 This function lets you jump to the next/previous non-empty tag.
390 It takes two arguments:
392 * `direction`: `1` for next non-empty tag, `-1` for previous.
393 * `sc`: Screen in which the taglist is. Default is `mouse.screen` or `1`. This
394 argument is optional.
398 globalkeys = awful.util.table.join(
400 -- Non-empty tag browsing
401 awful.key({ altkey }, "Left", function () vain.util.tag_view_nonempty(-1)
403 awful.key({ altkey }, "Right", function () vain.util.tag_view_nonempty(1) end),
409 This function enables you to dynamically rename the current tag you have
413 globalkeys = awful.util.table.join(
415 -- Dynamic tag renaming
416 awful.key({ modkey, "Shift" }, "r", function () vain.util.prompt_rename_tag(mypromptbox) end),
419 Credits goes to [minism](https://bbs.archlinux.org/viewtopic.php?pid=1315135#p1315135).