2008-09-29 16:49:18 +02:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
-- @author Julien Danjou <julien@danjou.info>
|
|
|
|
-- @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")
|
|
|
|
|
|
|
|
--- Screen module for awful
|
|
|
|
module("awful.screen")
|
|
|
|
|
2009-05-04 11:09:19 +02:00
|
|
|
local data = {}
|
|
|
|
data.padding = {}
|
|
|
|
|
2008-09-29 16:49:18 +02:00
|
|
|
--- Give the focus to a screen, and move pointer.
|
2009-08-21 16:05:02 +02:00
|
|
|
-- @param screen Screen number.
|
|
|
|
function focus(screen)
|
2009-08-21 20:26:16 +02:00
|
|
|
if screen > capi.screen.count() then screen = capi.mouse.screen end
|
2009-08-21 16:05:02 +02:00
|
|
|
local c = client.focus.history.get(screen, 0)
|
2008-09-29 16:49:18 +02:00
|
|
|
if c then capi.client.focus = c end
|
|
|
|
-- Move the mouse on the screen
|
2009-08-21 16:05:02 +02:00
|
|
|
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))
|
2008-09-29 16:49:18 +02:00
|
|
|
end
|
|
|
|
|
2009-05-04 11:09:19 +02:00
|
|
|
--- Get or set the screen padding.
|
2009-10-07 02:20:39 +02:00
|
|
|
-- @param screen The screen object to change the padding on
|
2009-05-04 11:09:19 +02:00
|
|
|
-- @param padding The padding, an table with 'top', 'left', 'right' and/or
|
|
|
|
-- 'bottom'. Can be nil if you only want to retrieve padding
|
2009-10-07 02:20:39 +02:00
|
|
|
function padding(screen, padding)
|
2009-05-04 11:09:19 +02:00
|
|
|
if padding then
|
2009-10-07 02:20:39 +02:00
|
|
|
data.padding[screen] = padding
|
|
|
|
screen:emit_signal("padding")
|
2009-05-04 11:09:19 +02:00
|
|
|
end
|
2009-10-07 02:20:39 +02:00
|
|
|
return data.padding[screen]
|
2009-05-04 11:09:19 +02:00
|
|
|
end
|
|
|
|
|
2012-03-25 17:41:12 +02:00
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|