awful.screen.focus: make focus() absolute and add focus_relative()
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
4823a12541
commit
0f6125a3f6
|
@ -198,10 +198,10 @@ globalkeys = awful.util.table.join(
|
|||
awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
|
||||
|
||||
-- Layout manipulation
|
||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
|
||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
|
||||
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus( 1) end),
|
||||
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus(-1) end),
|
||||
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
|
||||
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
|
||||
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
|
||||
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
|
||||
awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
|
||||
awful.key({ modkey, }, "Tab",
|
||||
function ()
|
||||
|
|
|
@ -21,13 +21,20 @@ local data = {}
|
|||
data.padding = {}
|
||||
|
||||
--- Give the focus to a screen, and move pointer.
|
||||
-- @param i Relative screen number.
|
||||
function focus(i)
|
||||
local s = util.cycle(capi.screen.count(), capi.mouse.screen + i)
|
||||
local c = client.focus.history.get(s, 0)
|
||||
-- @param screen Screen number.
|
||||
function focus(screen)
|
||||
local c = client.focus.history.get(screen, 0)
|
||||
if c then capi.client.focus = c end
|
||||
-- Move the mouse on the screen
|
||||
capi.mouse.screen = s
|
||||
capi.mouse.screen = screen
|
||||
end
|
||||
|
||||
--- Give the focus to a screen, and move pointer, but relative to the current
|
||||
-- focused screen.
|
||||
-- @param i Value to add to the current focused screen index. 1 will focus next
|
||||
-- screen, -1 would focus the previous one.
|
||||
function focus_relative(i)
|
||||
return focus(util.cycle(capi.screen.count(), capi.mouse.screen + i))
|
||||
end
|
||||
|
||||
--- Get or set the screen padding.
|
||||
|
|
Loading…
Reference in New Issue