![](/img/trans.png)
[英]awesome-wm wibox not reacting to mouse signals when input_passthrough is true
[英]Execute command when mouse touches screen edge in Awesome-wm
我是在Awesome中为rc.lua定制自定义lua的新手,在设计如何根据鼠标位置启动某些东西时遇到了一些麻烦。 到目前为止,这就是我所拥有的,但是它什么也没做。
-- Open todo when mouse hits right screen edge.
todo_timer = timer({timeout = 0.1})
todo_timer:add_signal("todopopup", function()
if mouse.coords.x >= 3198 then
scratch.drop("urxvt -e vim /home/ryan/to-do", "center", "right", 0.33, 1, "true")
end
end)
todo_timer:start()
--
您可以/应该像下面这样使用mousegrabber而不是使用计时器:
mousegrabber.run(function(mouse)
if mouse.x > 3196 then
-- Do your stuff here
end
-- Return true, to continue grabbing the mouse
return true
end)
这种方法的问题在于,一次只能注册一个捕鼠器。 因此,如果您只需要听一下鼠标的移动,这就是一个完美的解决方案。 如果需要更长的时间,则可以在需要抓取器进行其他操作时停止抓取(主要是客户端调整大小和移动),并在完成后启动抓取器。
这几乎可以按预期工作。 出于某种原因,暂存器第一次出现在屏幕1上,并且不能正确地垂直居中(此问题仅在水平位置为“正确”时发生,我认为这是暂存器的问题),对我来说,但它应该对人有用没有多显示器设置或用于启动您选择的其他命令的用户。
-- Open todo when mouse hits right screen edge.
local function todopad()
scratch.drop("urxvt -e vimpager /home/ryan/to-do", "center", "right", .20, 800, "true", 2)
end
todo_timer = timer({timeout = 1})
todo_timer:add_signal("timeout", function()
if mouse.coords()["x"] >= 3196 then
todopad()
end
end)
todo_timer:start()
--
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.