From 315f9027288dfc169f32f8415f07974ec329f848 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 25 Jul 2012 12:24:28 +0200 Subject: [PATCH] bindings: use own `screen_focus` function that do not move the mouse after focusing the client This allows a signal to put the mouse in the upper left corner of a newly focused window on another screen. --- rc/bindings.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rc/bindings.lua b/rc/bindings.lua index e554108..d4c68a8 100644 --- a/rc/bindings.lua +++ b/rc/bindings.lua @@ -87,6 +87,14 @@ local toggle_pidgin = toggle_window( -- Toggle urgent window local toggle_urgent = toggle_window(awful.client.urgent.get) +-- Focus a relative screen (similar to `awful.screen.focus_relative`) +local function screen_focus(i) + local s = awful.util.cycle(screen.count(), mouse.screen + i) + local c = awful.client.focus.history.get(s, 0) + mouse.screen = s + if c then client.focus = c end +end + config.keys.global = awful.util.table.join( keydoc.group("Focus"), awful.key({ modkey, }, "j", @@ -116,11 +124,11 @@ config.keys.global = awful.util.table.join( awful.key({ modkey, }, "u", toggle_pidgin, "Toggle Pidgin conversation window"), awful.key({ modkey, "Control" }, "j", function () - awful.screen.focus_relative( 1) + screen_focus( 1) end, "Jump to next screen"), awful.key({ modkey, "Control" }, "k", function () - awful.screen.focus_relative(-1) + screen_focus(-1) end), keydoc.group("Layout manipulation"),