lua - Mouse cylinder behaviour (dual-screen config)
问题描述
I've already asked a question about this in Unix & Linux SE and I so actually use xdotool.
The idea is that the mouse goes at the left of the left screen when it reaches the right of the right screen and vice versa.
But I recently saw the mouse.coords table in the awesome API, so I'd like to give up xdotool to set mouse coordinates as do xdotool with this possibility.
I suppose I should add a signal to the root to know when the mouse is on the edge, but I don't konw how to do this...
解决方案
我尝试一下我的想法,它奏效了。这是我正确的 wibox 的代码:
s.myjumpbox = awful.wibar({
position = "right",
screen = s,
width = 1,
opacity = 0,
ontop = true,
-- bg = beautiful.noir
})
s.myjumpbox:connect_signal("mouse::enter", function(w)
mouse.coords {
x = 2 ,
y = mouse.coords().y
}
end
)
编辑:添加 Uli 的建议
推荐阅读
- python - 第一次制作波表合成器......有人能指出我正确的方向吗?
- html - 如何使用 Angular 设置背景图像?
- python - 如何使用熊猫循环:'对于文件中的每一行,对于行中的每一列'
- vb.net - 使用 vb.net 中的组合框更改设置
- c++ - 在 C++ 非类型模板参数中使用 decltype(auto)
- javascript - 简明检查变量是否是对象但不是数组或日期
- python - 生成 django admin 和外键错误
- string - Rust 惰性静态自定义结构实例
- r - 将 DUMMIFIED 列添加到 R 中的 ORIGINAL DATASET
- xamarin.forms - 如何转换为 Java.Lang.Double