lain/yawn.md

91 lines
2.4 KiB
Markdown
Raw Normal View History

2013-09-08 15:19:10 +02:00
(YAhoo! Weather Notification)
2013-09-08 15:14:11 +02:00
2013-09-08 15:19:10 +02:00
Yawn provides brief and compact Yahoo! Weather notification.
2013-09-08 15:14:11 +02:00
Usage
-----
You can ``register`` Yawn to get a set of widgets, or ``attach`` it to
an existent widget.
### register
yawn = lain.widgets.yawn(id, args)
- ``id``
An integer that defines the WOEID code of your city.
To obtain it you can google 'yahoo weather %CITYNAME%' and follow the first link.
It will look like:
http://weather.yahoo.com/united-states/california/san-diego-2487889/
and the last number in that link will be the ID you need.
- ``args``
2013-09-11 00:10:43 +02:00
A required table which can contain:
2013-09-08 15:14:11 +02:00
Variables | Meaning | Type | Possible values | Default value
--- | --- | --- | --- | ---
`u` | Units | string | "c" (Celsius), "f" (Fahrenheit) | "c"
2013-09-11 00:10:43 +02:00
`timeout` | Refresh timeout seconds | int | integers | 600
`settings` | User settings | function | function | empty function
2013-09-08 15:14:11 +02:00
2013-09-11 00:10:43 +02:00
`settings` can use strings `forecast`, `units', and can modify `notification_preset` table, which
will be the preset for the naughty notifications. Check [here](http://awesome.naquadah.org/doc/api/modules/naughty.html#notify) for the list of variables it can contain.
The function `register` creates an imagebox icon and a textbox widget. Add them to you wibox like this:
2013-09-08 15:14:11 +02:00
right_layout:add(yawn.icon)
right_layout:add(yawn.widget)
Hovering over ``yawn.icon`` will display the notification.
### attach
lain.widgets.yawn.attach(widget, id, args)
Arguments:
- ``widget``
2013-09-08 15:15:08 +02:00
The widget which you want to attach Yawn to.
2013-09-08 15:14:11 +02:00
- ``id``
Same as in ``register``.
- ``args``
Same as in ``register``.
Hovering over ``widget`` will display the notification.
Popup shortcut
--------------
2013-09-08 15:19:10 +02:00
You can also create a keybinding for the weather popup like this:
2013-09-08 15:14:11 +02:00
awful.key( { "Mod1" }, "w", function () yawn.show(5) end )
where ``show`` argument is an integer defining timeout seconds.
Localization
------------
Default language is English, but Yawn can be localized.
Move to `localizations` subdirectory and fill `localization_template`.
Once you're done, rename it like your locale id. In my case:
$ lua
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> print(os.getenv("LANG"):match("(%S*$*)[.]"))
it_IT
>
hence I named my file "it_IT" (Italian localization).
**NOTE:** If you create a localization, feel free to send me! I will add it.