awesome-wm gears.timer 设置

awesome-wm gears.timer setup

我想在 awesome-wm 中用 gears.timer 替换弃用的 awful.timer。但我无法启动它。我从 example 中获取函数作为原型并编写了简单的测试函数。在这里:

gears.timer {
    timeout   = 1,
    autostart = true,
    callback  = function()
        print("!!Timeout!!")
    end
}

我把它放在了rc.lua文件和运行awesome的末尾。从 awesome-wm 输出的外观来看,函数似乎从未运行过。我如何设置 gears.timer 才能运行?

P.S。我使用此命令查看 awesome-wm:

的输出
DISPLAY=:0; Xephyr :1 -screen 800x600 -ac -br -noreset & \
DISPLAY=:1.0; sleep 1; awesome -c ~/.config/awesome/rc.lua

我能够让 gears.timer 作为信号发射器工作:

timer = gears.timer {
    timeout   = 1
}

timer:connect_signal("timeout", function()
        print("!!Timeout!!")
    end
)

timer:start()

不过,我对 autostartcallback 属性的使用仍然有些困惑。

Awesome 4.0 仅支持 gears.timer 的超时参数。 autostart 参数和 callback 参数是 awesome 4.1 中的新参数。