[英]awesome-wm gears.timer setup
I want to replace deprecated awful.timer
with gears.timer
in my awesome-wm
. 我想在awesome-wm
中用gears.timer
替换不推荐使用的awful.timer
。 But I having trouble starting it. 但是我无法启动它。 I took function from the example as a prototype and wrote simple test function. 我从示例中获取函数作为原型,并编写了简单的测试函数。 Here it is: 这里是:
gears.timer {
timeout = 1,
autostart = true,
callback = function()
print("!!Timeout!!")
end
}
I placed it in the end of the rc.lua
file and ran awesome
. 我将其放置在rc.lua
文件的末尾,并运行得awesome
。 From the look of the awesome-wm output it looks like function never runs. 从真棒wm输出的外观看,函数似乎永远不会运行。 How do I setup gears.timer
so it runs? 如何设置gears.timer
,使其运行?
PS I use this command to see the output of the awesome-wm
: PS我使用此命令来查看awesome-wm
的输出:
DISPLAY=:0; Xephyr :1 -screen 800x600 -ac -br -noreset & \
DISPLAY=:1.0; sleep 1; awesome -c ~/.config/awesome/rc.lua
Awesome 4.0 only supports the timeout argument for gears.timer
. Awesome 4.0仅支持gears.timer
的timeout参数。 The autostart
argument and the callback
argument are new in awesome 4.1. autostart
参数和callback
参数是Awesome 4.1中的新增功能。
I was able to make gears.timer
work as a signal emitter: 我能够使gears.timer
用作信号发射器:
timer = gears.timer {
timeout = 1
}
timer:connect_signal("timeout", function()
print("!!Timeout!!")
end
)
timer:start()
However I'm still a bit puzzled about usege of autostart
and callback
attributes. 但是,我对autostart
和callback
属性的使用仍然感到困惑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.