On 22/08/12 10:05:19 +0530, Anurag Priyam wrote:
> On Wed, Aug 22, 2012 at 9:51 PM, Ignas Anikevicius
> <anikevic...@gmail.com> wrote:
> > I have written a small patch, which changes the behaviour, so that we
> > have the mouse repositioned to the centre of the screen. Could we have
> 
> Where is the patch?
> 
> -- 
> Anurag Priyam

Sorry, for forgetting attaching it...
>From d0fa2a95d6cb6155455d1636198f94a38da4cf7a Mon Sep 17 00:00:00 2001
From: "Ignas Anikevicius (gns_ank)" <anikevic...@gmail.com>
Date: Wed, 22 Aug 2012 17:11:02 +0100
Subject: [PATCH] awful.screen.focus move mouse to the centre

Move the mouse towards the centre of the screen when using
awful.screen.focus functions. This is a sane default as it is much
easier to see, which screen is now focused. If people do not like mouse
being in the centre, they can use tools like unclutter.

I hope that this is a more sane default behaviour.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevic...@gmail.com>
---
 lib/awful/screen.lua.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/awful/screen.lua.in b/lib/awful/screen.lua.in
index d9a4625..aa3db07 100644
--- a/lib/awful/screen.lua.in
+++ b/lib/awful/screen.lua.in
@@ -45,6 +45,10 @@ function screen.focus(_screen)
     if c then capi.client.focus = c end
     -- Move the mouse on the screen
     capi.mouse.screen = _screen
+
+    -- Move the mouse into the middle of the screen
+    local geo = capi.screen[_screen].geometry
+    capi.mouse.coords({x = geo.x + geo.width/2, y = geo.y + geo.height/2})
 end
 
 --- Give the focus to a screen, and move pointer, but relative to the current
-- 
1.7.12

Reply via email to