awesome/lib/awful/screen.lua.in
Julien Danjou e15aab73bf screen: move padding in Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-04 17:51:13 +02:00

49 lines
1.4 KiB
Lua

---------------------------------------------------------------------------
-- @author Julien Danjou &lt;julien@danjou.info&gt;
-- @copyright 2008 Julien Danjou
-- @release @AWESOME_VERSION@
---------------------------------------------------------------------------
-- Grab environment we need
local capi =
{
mouse = mouse,
screen = screen,
client = client
}
local util = require("awful.util")
local client = require("awful.client")
local hooks = require("awful.hooks")
--- Screen module for awful
module("awful.screen")
local data = {}
data.padding = {}
-- Create a hook for padding event
hooks.user.create("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)
if c then capi.client.focus = c end
-- Move the mouse on the screen
capi.mouse.screen = s
end
--- Get or set the screen padding.
-- @param i The screen number.
-- @param padding The padding, an table with 'top', 'left', 'right' and/or
-- 'bottom'. Can be nil if you only want to retrieve padding
function padding(i, padding)
if padding then
data.padding[i] = padding
hooks.user.call("padding", i)
end
return data.padding[i]
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80