From c795642c2ff03e451ecebae05f787933da5fa5ed Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 2 Nov 2013 18:34:55 +0100 Subject: README: update awesome usage examples for v3.5 Signed-off-by: Adrian C. (anrxc) --- README | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'README') diff --git a/README b/README index bf16d36..79c40bd 100644 --- a/README +++ b/README @@ -387,7 +387,7 @@ file with their GPG key. Trough the GPG Passphrase Agent they could then decrypt the file transparently while their session is active. -Usage examples (for awesome v3.4) +Usage examples --------------------------------- Start with a simple widget, like date. Then build your setup from there, one widget at a time. Also remember that besides creating and @@ -395,14 +395,14 @@ registering widgets you have to add them to a wibox (statusbar) in order to actually display them. Date widget - datewidget = widget({ type = "textbox" }) + datewidget = wibox.widget.textbox() vicious.register(datewidget, vicious.widgets.date, "%b %d, %R") - updated every 2 seconds (the default interval), uses standard date sequences as the format string Memory widget - memwidget = widget({ type = "textbox" }) + memwidget = wibox.widget.textbox() vicious.cache(vicious.widgets.mem) vicious.register(memwidget, vicious.widgets.mem, "$1 ($2MB/$3MB)", 13) @@ -410,7 +410,7 @@ Memory widget values and enables caching of this widget type HDD temperature widget - hddtempwidget = widget({ type = "textbox" }) + hddtempwidget = wibox.widget.textbox() vicious.register(hddtempwidget, vicious.widgets.hddtemp, "${/dev/sda} °C", 19) - updated every 19 seconds, requests the temperature level of the @@ -418,7 +418,7 @@ HDD temperature widget not provide the port argument so default port is used Mbox widget - mboxwidget = widget({ type = "textbox" }) + mboxwidget = wibox.widget.textbox() vicious.register(mboxwidget, vicious.widgets.mbox, "$1", 5, "/home/user/mail/Inbox") - updated every 5 seconds, provides full path to the mbox as an @@ -431,8 +431,8 @@ Battery widget batwidget:set_vertical(true) batwidget:set_background_color("#494B4F") batwidget:set_border_color(nil) - batwidget:set_color("#AECF96") - batwidget:set_gradient_colors({ "#AECF96", "#88A175", "#FF5656" }) + batwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 0, 10 }, + stops = { { 0, "#AECF96" }, { 0.5, "#88A175" }, { 1, "#FF5656" }}) vicious.register(batwidget, vicious.widgets.bat, "$2", 61, "BAT0") - updated every 61 seconds, requests the current battery charge @@ -443,8 +443,8 @@ CPU usage widget cpuwidget = awful.widget.graph() cpuwidget:set_width(50) cpuwidget:set_background_color("#494B4F") - cpuwidget:set_color("#FF5656") - cpuwidget:set_gradient_colors({ "#FF5656", "#88A175", "#AECF96" }) + cpuwidget:set_color({ type = "linear", from = { 0, 0 }, to = { 50, 0 }, + stops = { { 0, "#FF5656" }, { 0.5, "#88A175" }, { 1, "#AECF96" }}) vicious.register(cpuwidget, vicious.widgets.cpu, "$1", 3) - updated every 3 seconds, feeds the graph with total usage @@ -468,7 +468,7 @@ second argument, and will return the text/data to be used for the widget. Example - mpdwidget = widget({ type = "textbox" }) + mpdwidget = wibox.widget.textbox() vicious.register(mpdwidget, vicious.widgets.mpd, function (widget, args) if args["{state}"] == "Stop" then return "" @@ -481,7 +481,7 @@ Example seconds (the default interval) Example - uptimewidget = widget({ type = "textbox" }) + uptimewidget = wibox.widget.textbox() vicious.register(uptimewidget, vicious.widgets.uptime, function (widget, args) return string.format("Uptime: %2dd %02d:%02d ", args[1], args[2], args[3]) @@ -496,9 +496,10 @@ textbox widgets by changing their .width field (by default width is automatically adapted to text width). Example - uptimewidget = widget({ type = "textbox" }) - uptimewidget.width, uptimewidget.align = 50, "right" + uptimewidget = wibox.widget.textbox() + uptimewidget:set_align("right") vicious.register(uptimewidget, vicious.widgets.uptime, "$1 $2:$3", 61) + uptimewidget = wibox.layout.constraint(uptimewidget, "exact", 50, nil) - forces a fixed width of 50px to the uptime widget, and aligns its text to the right @@ -509,7 +510,7 @@ color index arguments elegantly. But they are not unusable, far from it. Example - ctext = widget({ type = "textbox"}) + ctext = wibox.widget.textbox() cgraph = awful.widget.graph() cgraph:set_width(100):set_height(20) cgraph:set_stack(true):set_max_value(100) @@ -530,7 +531,7 @@ A lot of users are not happy with default symbols used in volume, battery, cpufreq and other widget types. You can use your own symbols without any need to modify modules. - volumewidget = widget({ type = "textbox"}) + volumewidget = wibox.widget.textbox() vicious.register(volumewidget, vicious.widgets.volume, function(widget, args) local label = { ["♫"] = "O", ["♩"] = "M" } -- cgit v1.2.3