Search code examples
luamousemultiple-monitorsawesome-wm

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...


Solution

  • I give a try to my idea, and it works. Here's the code for my right 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
    )
    

    Edit : add Uli's suggestions