[lua] Split screen.* out of awesome.*
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
c3d16391f5
commit
60c8a3593d
|
@ -24,7 +24,7 @@ layouts = { "tile", "tileleft", "tilebottom", "tiletop", "max", "spiral", "dwind
|
|||
-- {{{ Tags
|
||||
-- Define tags table
|
||||
tags = {}
|
||||
for s = 1, awesome.screen_count() do
|
||||
for s = 1, screen.count() do
|
||||
-- Each screen has its own tag table
|
||||
tags[s] = {}
|
||||
-- Create 9 tags per screen
|
||||
|
@ -71,13 +71,13 @@ myiconbox:set("image", "@iconsdir@/awesome16.png")
|
|||
-- Create an iconbox widget which will contains an icon indicating which layout we're using.
|
||||
-- We need one layoutbox per screen.
|
||||
mylayoutbox = {}
|
||||
for s = 1, awesome.screen_count() do
|
||||
for s = 1, screen.count() do
|
||||
mylayoutbox[s] = widget.new({ type = "iconbox", name = "myiconbox", align = "right" })
|
||||
mylayoutbox[s]:set("image", "@iconsdir@/layouts/tilew.png")
|
||||
end
|
||||
|
||||
-- Create a statusbar for each screen and add it
|
||||
for s = 1, awesome.screen_count() do
|
||||
for s = 1, screen.count() do
|
||||
mystatusbar = statusbar.new({ position = "top", name = "mystatusbar" .. s,
|
||||
fg = "lightblue", bg = "black" })
|
||||
-- Add widgets to the statusbar - order matters
|
||||
|
@ -118,7 +118,7 @@ client.mouse({ modkey }, 3, function (c) c:mouse_resize() end)
|
|||
-- Bind keyboard digits
|
||||
-- Compute the maximum number of digit we need, limited to 9
|
||||
keynumber = 0
|
||||
for s = 1, awesome.screen_count() do
|
||||
for s = 1, screen.count() do
|
||||
keynumber = math.min(9, math.max(#tags[s], keynumber));
|
||||
end
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ end
|
|||
-- Grab environment we need
|
||||
local ipairs = ipairs
|
||||
local awesome = awesome
|
||||
local screen = screen
|
||||
local client = client
|
||||
local tag = tag
|
||||
local mouse = mouse
|
||||
|
@ -77,16 +78,16 @@ function screen_focus(i)
|
|||
else
|
||||
s = mouse.screen_get()
|
||||
end
|
||||
local count = awesome.screen_count()
|
||||
local count = screen.count()
|
||||
s = s + i
|
||||
if s < 1 then
|
||||
s = count
|
||||
elseif s > count then
|
||||
s = 1
|
||||
end
|
||||
awesome.screen_focus(s)
|
||||
screen.focus(s)
|
||||
-- Move the mouse on the screen
|
||||
local screen_coords = awesome.screen_coords_get(s)
|
||||
local screen_coords = screen.coords_get(s)
|
||||
mouse.coords_set(screen_coords['x'], screen_coords['y'])
|
||||
end
|
||||
|
||||
|
|
12
lua.c
12
lua.c
|
@ -430,9 +430,6 @@ luaA_parserc(const char *rcfile)
|
|||
{ "restart", luaA_restart },
|
||||
{ "floating_placement_set", luaA_floating_placement_set },
|
||||
{ "padding_set", luaA_padding_set },
|
||||
{ "screen_coords_get", luaA_screen_coords_get },
|
||||
{ "screen_count", luaA_screen_count },
|
||||
{ "screen_focus", luaA_screen_focus },
|
||||
{ "key", luaA_key },
|
||||
{ "mouse", luaA_mouse },
|
||||
{ "resizehints_set", luaA_resizehints_set },
|
||||
|
@ -440,6 +437,12 @@ luaA_parserc(const char *rcfile)
|
|||
{ "colors_set", luaA_colors_set },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
static const struct luaL_reg awesome_screen_lib[] =
|
||||
{
|
||||
{ "coords_get", luaA_screen_coords_get },
|
||||
{ "count", luaA_screen_count },
|
||||
{ "focus", luaA_screen_focus },
|
||||
};
|
||||
static const struct luaL_reg awesome_hooks_lib[] =
|
||||
{
|
||||
{ "focus", luaA_hooks_focus },
|
||||
|
@ -459,6 +462,9 @@ luaA_parserc(const char *rcfile)
|
|||
/* Export awesome lib */
|
||||
luaL_register(L, "awesome", awesome_lib);
|
||||
|
||||
/* Export screen lib */
|
||||
luaL_register(L, "screen", awesome_screen_lib);
|
||||
|
||||
/* Export hooks lib */
|
||||
luaL_register(L, "hooks", awesome_hooks_lib);
|
||||
|
||||
|
|
Loading…
Reference in New Issue