diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:49:17 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2024-10-18 21:49:17 -0500 |
commit | 923eb46350b1102749eb05cd2120c96cc6a715d0 (patch) | |
tree | 811da20b4195d4b5c65c8ac0090982a4a23f6a7d /func/warpcursor.lua | |
download | awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.tar.xz awesome-923eb46350b1102749eb05cd2120c96cc6a715d0.zip |
initial commit
Diffstat (limited to 'func/warpcursor.lua')
-rw-r--r-- | func/warpcursor.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/func/warpcursor.lua b/func/warpcursor.lua new file mode 100644 index 0000000..f1a46bd --- /dev/null +++ b/func/warpcursor.lua @@ -0,0 +1,22 @@ +function warp_cursor(c) +-- if c ~= client.focus or not c.warp_cursor then + if not c.warp_cursor then + return + end + + -- dont allow moving mouse unless it is over another client or over nothing + local canmovemouse = mouse.current_client or (mouse.current_wibox or mouse.current_widget) == nil + + if canmovemouse and mouse.current_client ~= c then + mouse.coords { + x = c.x + (c.width / 2), + y = c.y + (c.height / 2), + } + end +end + +client.connect_signal("focus", warp_cursor) +--client.connect_signal("property::size", warp_cursor) +--client.connect_signal("property::position", warp_cursor) + +return warp_cursor |