On 05/27/2010 09:41 AM, Adam Nielsen wrote:
>>> Is it possible to tell Awesome to move the cursor to say (5,0) upon
>>> changing
>>> monitors instead?
>>
>> Yup. I'm not exactly sure which code to use, but the general procedure
>> would be:
>>
>> 1-1) find the right signal to hook (for screen change) here
>> http://awesome.naquadah.org/wiki/Signals
>> 1-2) alternatively, just edit your bind for switching screens, if
>> that's the only thing you want affected rather than all screen
>> changes. This approach may be easier and more along the lines of what
>> you want.
>> 2) Use this to set the desired mouse coords:
>> http://awesome.naquadah.org/doc/api/modules/mouse.html#coords
> 
> Thanks for your suggestions.  I tried the second approach and changed my
> bind to this:
> 
>   awful.key({ modkey, }, "F1", function ()
>     awful.screen.focus(1)
>     mouse.coords( { 10, 20 } , false)
>   end),
> 
> But unfortunately it doesn't make a difference (screen switches ok but
> cursor stays at 0,0).  I also tried setting the coords to { x = 10, y =
> 20 } as I'm not quite sure what the docs imply, but it didn't make a
> difference.  Am I doing something wrong?

I don't think so, as, specifying x and y should be OK, as I had the same
problem...
I can give you two snippets, working well on awesome 3.4.4.

I wanted to have a little hook, saying If I want to switch to tag n on
screen 1, and screen 1 is already on tag n, then switch to tag n on the
next screen, and put the cursor in the middle:

 awful.key({ modkey }, qwertyKeys[i],
   function ()
      local t = tags[mouse.screen][i]
      -- Change tag on other screen if already on tag i, and focus
      if t == awful.tag.selected(mouse.screen) then
         local s = (mouse.screen + 1) % screen.count()
         if s == 0 then s = screen.count() end
         awful.tag.viewonly(tags[s][i])
         awful.screen.focus(s)
         mouse.coords( { x = 4800 - s*1920, y = 600 } )
      else
         awful.tag.viewonly(t)
      end
  end),

In the same idea, I have a Mod+Tab to focus to other screen:

  awful.key({ modkey }, "Tab", function ()
        awful.screen.focus_relative(1)
        local s = mouse.screen
        mouse.coords( { x = 4800 - s*1920, y = 600 } )
        end),

Hope it can helps

,Cyprien

-- 
To unsubscribe, send mail to [email protected].

Reply via email to