Menubar: Cleanup the environment grabbing

All of the capi should be in a capi table. This make the code more
consistent. Also, it is not worth importing awful.prompt as a different
variable as it is used only once. Calling it awful.prompt make the code
clearer as there are other variables called prompt.

Signed-off-by: Ignas Anikevicius (gns_ank) <anikevicius@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Ignas Anikevicius (gns_ank) 2012-05-04 23:06:53 +01:00 committed by Uli Schlachter
parent 3901369410
commit 6809f6afcf
1 changed files with 15 additions and 12 deletions

View File

@ -5,22 +5,25 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
-- Grab environment we need -- Grab environment we need
local capi = { client = client, local capi = {
screen = screen } client = client,
local setmetatable = setmetatable mouse = mouse,
screen = screen
}
local awful = require("awful")
local common = require("awful.widget.common")
local theme = require("beautiful")
local menu_gen = require("menubar.menu_gen")
local wibox = require("wibox")
-- Standard lua
local pairs = pairs local pairs = pairs
local ipairs = ipairs local ipairs = ipairs
local table = table local table = table
local theme = require("beautiful")
local menu_gen = require("menubar.menu_gen")
local prompt = require("awful.prompt")
local awful = require("awful")
local common = require("awful.widget.common")
local tonumber = tonumber local tonumber = tonumber
local string = string local string = string
local mouse = mouse
local math = math local math = math
local wibox = require("wibox") local setmetatable = setmetatable
module("menubar") module("menubar")
@ -226,7 +229,7 @@ function show(scr)
end end
-- Set position and size -- Set position and size
scr = scr or mouse.screen or 1 scr = scr or capi.mouse.screen or 1
local scrgeom = capi.screen[scr].workarea local scrgeom = capi.screen[scr].workarea
instance.wibox:geometry({x = geometry.x or scrgeom.x, instance.wibox:geometry({x = geometry.x or scrgeom.x,
y = geometry.y or scrgeom.y, y = geometry.y or scrgeom.y,
@ -236,7 +239,7 @@ function show(scr)
current_item = 1 current_item = 1
current_category = nil current_category = nil
menulist_update() menulist_update()
prompt.run({ prompt = "Run app: " }, instance.prompt.widget, function(s) end, awful.prompt.run({ prompt = "Run app: " }, instance.prompt.widget, function(s) end,
nil, awful.util.getdir("cache") .. "/history_menu", nil, hide, nil, awful.util.getdir("cache") .. "/history_menu", nil, hide,
menulist_update, menulist_update,
prompt_keypressed_callback) prompt_keypressed_callback)