Use gears.timer

This commit is contained in:
Guillaume Dott 2017-01-23 15:28:22 +01:00
parent bea3f2784b
commit d694cce88b
2 changed files with 10 additions and 8 deletions

View File

@ -2,7 +2,8 @@ local awful = require("awful")
local naughty = require("naughty") local naughty = require("naughty")
local wibox = require("wibox") local wibox = require("wibox")
local timer = timer local timer = require("gears.timer")
local string = string local string = string
local os = { local os = {
getenv = os.getenv, getenv = os.getenv,
@ -118,9 +119,9 @@ function mpc.init()
end) end)
)) ))
local timer = timer { timeout = 2 } local tm = timer { timeout = 2, }
timer:connect_signal("timeout", function() tb:set_text(music_current_short()) end) tm:connect_signal("timeout", function() tb:set_text(music_current_short()) end)
timer:start() tm:start()
tb:set_text(music_current_short()) tb:set_text(music_current_short())
return tb return tb

View File

@ -2,7 +2,8 @@ local awful = require("awful")
local wibox = require("wibox") local wibox = require("wibox")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local timer = timer local timer = require("gears.timer")
local string = string local string = string
local tonumber = tonumber local tonumber = tonumber
local os = { local os = {
@ -72,9 +73,9 @@ function volume_widget.init(a_mode, a_channel)
tb:buttons(but) tb:buttons(but)
img:buttons(but) img:buttons(but)
local timer = timer { timeout = 7 } local tm = timer { timeout = 7, }
timer:connect_signal("timeout", function() volume_widget.volume("display") end) tm:connect_signal("timeout", function() volume_widget.volume("display") end)
timer:start() tm:start()
end end