From 6809f6afcf566668764c3e4d48977e26212d124f Mon Sep 17 00:00:00 2001 From: "Ignas Anikevicius (gns_ank)" Date: Fri, 4 May 2012 23:06:53 +0100 Subject: [PATCH] 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) Signed-off-by: Uli Schlachter --- lib/menubar/init.lua.in | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/menubar/init.lua.in b/lib/menubar/init.lua.in index 32c4218fd..43647bc7b 100644 --- a/lib/menubar/init.lua.in +++ b/lib/menubar/init.lua.in @@ -5,22 +5,25 @@ --------------------------------------------------------------------------- -- Grab environment we need -local capi = { client = client, - screen = screen } -local setmetatable = setmetatable +local capi = { + client = client, + 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 ipairs = ipairs 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 string = string -local mouse = mouse local math = math -local wibox = require("wibox") +local setmetatable = setmetatable module("menubar") @@ -226,7 +229,7 @@ function show(scr) end -- 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 instance.wibox:geometry({x = geometry.x or scrgeom.x, y = geometry.y or scrgeom.y, @@ -236,7 +239,7 @@ function show(scr) current_item = 1 current_category = nil 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, menulist_update, prompt_keypressed_callback)