awesome/my.lua
changeset 11 7226709dc4c4
parent 9 56e80afa3e1c
child 12 ffc02bf394cb
--- a/awesome/my.lua	Sat Jan 03 11:21:56 2015 -0500
+++ b/awesome/my.lua	Sun Jun 14 22:18:07 2015 -0400
@@ -1,20 +1,14 @@
-require("naughty")
-require("awful")
-require("debug")
-require("vicious")
-require("wicked")
-require("beautiful")
-require("timer")
+local naughty = require("naughty")
+local awful = require("awful")
+local debug = require("debug")
+local vicious = require("vicious")
+local wicked = require("wicked")
+local beautiful = require("beautiful")
+local timer = require("timer")
+local wibox = require("wibox")
 
 local ipairs = ipairs
 local pairs = pairs
-local naughty = naughty
-local awful = awful
-local debug = debug
-local vicious = vicious
-local wicked = wicked
-local beautiful = beautiful
-local timer = timer
 
 local capi = {
    keygrabber = keygrabber,
@@ -25,6 +19,10 @@
 
 module("my")
 
+local function get_gradient_colors(c1, c2, c3)
+   return { type = "linear", from = { 0, 0 }, to = { 0, 20 }, stops = { { 0, c1 }, { 0.5, c2 }, { 1, c3 } }}
+end
+
 local in_error = false
 function notify_error(err)
    -- Make sure we don't go into an endless error loop
@@ -75,7 +73,7 @@
    -- Graph properties
    w:set_width(30)
    w:set_background_color("#729fcf")
-   w:set_gradient_colors({ "#729fcf", "LightBlue", "white" })
+   w:set_color(get_gradient_colors("#729fcf", "LightBlue", "white"))
 -- Register widget
    vicious.register(w, vicious.widgets.cpu, "$1", 1)
    return w
@@ -83,7 +81,7 @@
 
 local function widgets_mdp()
    -- Initialize widget
-   local w = capi.widget({ type = "textbox" })
+   local w = wibox.widget.textbox()
    -- Register widget
    vicious.register(w, vicious.widgets.mpd,
                     function (widget, args)
@@ -103,14 +101,14 @@
    w:set_width(10)
    w:set_vertical(true)
    w:set_background_color("#729fcf")
-   w:set_gradient_colors({ "#729fcf", "LightBlue", "white" })
+   w:set_color(get_gradient_colors("#729fcf", "LightBlue", "white"))
 -- Register widget
    vicious.register(w, vicious.widgets.mem, "$1", 5)
    return w
 end
 
 local function widgets_net(device)
-   local w = capi.widget({ type = "textbox"})
+   local w = wibox.widget.textbox()
    -- w:set_vertical(true)
    w.width = 150
    w.align = 'center'
@@ -121,13 +119,13 @@
 end
 
 local function widgets_mode()
-   local w = capi.widget({ type = "textbox"})
+   local w = wibox.widget.textbox()
    widgets.mode_widget = w
    return w
 end
 
 local function widgets_keyboard()
-   local w = capi.widget({ type = "textbox"})
+   local w = wibox.widget.textbox()
    widgets.keyboard_widget = w
    return w
 end
@@ -311,10 +309,10 @@
 
 function sloppy_install(delay)
    sloppy_timer = timer({ timeout = delay })
-   sloppy_timer:add_signal("timeout", sloppy_on_timeout)
+   sloppy_timer:connect_signal("timeout", sloppy_on_timeout)
    sloppy_timer:start()
-   capi.client.add_signal("manage", function (c)
-                             c:add_signal("mouse::enter", sloppy_mouse_enter)
+   capi.client.connect_signal("manage", function (c)
+                             c:connect_signal("mouse::enter", sloppy_mouse_enter)
    end)
-   capi.client.add_signal("focus", function () sloppy_timer:stop() end)
+   capi.client.connect_signal("focus", function () sloppy_timer:stop() end)
 end