summaryrefslogtreecommitdiff
path: root/awesome/func/warpcursor.lua
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2024-10-11 20:43:20 -0500
committerTim Keller <tjk@tjkeller.xyz>2024-10-11 20:43:20 -0500
commitce020ab718b0ea09224dd15fc9a5796b3acc7904 (patch)
tree5d1ab3fb93f85d6fbf1b9fe84dfcd3484ce6ef33 /awesome/func/warpcursor.lua
parent5e84a09eb67772b07a73102538d2445ecb403613 (diff)
downloaddotconfig-ce020ab718b0ea09224dd15fc9a5796b3acc7904.tar.xz
dotconfig-ce020ab718b0ea09224dd15fc9a5796b3acc7904.zip
overhaul awesome
Diffstat (limited to 'awesome/func/warpcursor.lua')
-rw-r--r--awesome/func/warpcursor.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/awesome/func/warpcursor.lua b/awesome/func/warpcursor.lua
new file mode 100644
index 0000000..f1a46bd
--- /dev/null
+++ b/awesome/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