luaa: move version and release to awesome module

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-04-28 16:21:50 +02:00
parent 56225a39fe
commit 3eb14d7c76
4 changed files with 10 additions and 12 deletions

View File

@ -90,7 +90,7 @@ end
-- Create a textbox widget
mytextbox = widget({ type = "textbox", align = "right" })
-- Set the default text in textbox
mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>"
mytextbox.text = "<b><small> " .. awesome.release .. " </small></b>"
-- Create a laucher widget and a main menu
myawesomemenu = {

View File

@ -103,6 +103,7 @@ type
urgent
valign
visible
version
vertical
widgets
width

View File

@ -16,12 +16,11 @@ local string = string
local widget = widget
local button = require("awful.button")
local util = require("awful.util")
local capi = { screen = screen }
local capi = { screen = screen, awesome = awesome }
local bt = require("beautiful")
local screen = screen
local awful = awful
local dbus = dbus
local AWESOME_VERSION = AWESOME_VERSION
--- Notification library
module("naughty")
@ -469,7 +468,7 @@ if awful.hooks.dbus then
end
elseif data.member == "GetServerInfo" or data.member == "GetServerInformation" then
-- name of notification app, name of vender, version
return "s", "naughty", "s", "awesome", "s", AWESOME_VERSION:match("%d.%d")
return "s", "naughty", "s", "awesome", "s", capi.awesome.version:match("%d.%d")
end
end)

14
luaa.c
View File

@ -593,6 +593,12 @@ luaA_awesome_index(lua_State *L)
case A_TK_BG:
luaA_pushxcolor(L, &globalconf.colors.bg);
break;
case A_TK_VERSION:
lua_pushliteral(L, AWESOME_VERSION);
break;
case A_TK_RELEASE:
lua_pushliteral(L, AWESOME_RELEASE);
break;
default:
return 0;
}
@ -715,14 +721,6 @@ luaA_init(xdgHandle* xdg)
/* Export keys */
luaA_openlib(L, "key", awesome_key_methods, awesome_key_meta);
lua_pushliteral(L, "AWESOME_VERSION");
lua_pushstring(L, AWESOME_VERSION);
lua_settable(L, LUA_GLOBALSINDEX);
lua_pushliteral(L, "AWESOME_RELEASE");
lua_pushstring(L, AWESOME_RELEASE);
lua_settable(L, LUA_GLOBALSINDEX);
/* init hooks */
globalconf.hooks.manage = LUA_REFNIL;
globalconf.hooks.unmanage = LUA_REFNIL;