2009-04-08 17:08:26 +02:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
-- @author Julien Danjou <julien@danjou.info>
|
|
|
|
-- @copyright 2009 Julien Danjou
|
|
|
|
-- @release @AWESOME_VERSION@
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
-- Grab environment we need
|
2009-06-15 20:52:40 +02:00
|
|
|
require("awful.dbus")
|
2012-06-16 14:22:35 +02:00
|
|
|
local load = loadstring or load -- v5.1 - loadstring, v5.2 - load
|
2009-04-08 17:08:26 +02:00
|
|
|
local tostring = tostring
|
|
|
|
local ipairs = ipairs
|
|
|
|
local table = table
|
2012-06-15 10:49:33 +02:00
|
|
|
local unpack = unpack or table.unpack -- v5.1: unpack, v5.2: table.unpack
|
2009-04-18 16:07:31 +02:00
|
|
|
local dbus = dbus
|
2009-04-08 17:08:26 +02:00
|
|
|
local type = type
|
|
|
|
|
2009-08-28 15:36:34 +02:00
|
|
|
--- Remote control module allowing usage of awesome-client.
|
2012-06-12 20:13:09 +02:00
|
|
|
-- awful.remote
|
2009-04-08 17:08:26 +02:00
|
|
|
|
2009-06-15 20:52:40 +02:00
|
|
|
if dbus then
|
2009-10-09 20:39:55 +02:00
|
|
|
dbus.connect_signal("org.naquadah.awesome.awful.Remote", function(data, code)
|
2009-04-08 17:08:26 +02:00
|
|
|
if data.member == "Eval" then
|
2012-06-16 14:22:35 +02:00
|
|
|
local f, e = load(code)
|
2009-04-08 17:08:26 +02:00
|
|
|
if f then
|
|
|
|
results = { f() }
|
|
|
|
retvals = {}
|
|
|
|
for _, v in ipairs(results) do
|
|
|
|
local t = type(v)
|
|
|
|
if t == "boolean" then
|
|
|
|
table.insert(retvals, "b")
|
|
|
|
table.insert(retvals, v)
|
|
|
|
elseif t == "number" then
|
|
|
|
table.insert(retvals, "d")
|
|
|
|
table.insert(retvals, v)
|
|
|
|
else
|
|
|
|
table.insert(retvals, "s")
|
|
|
|
table.insert(retvals, tostring(v))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return unpack(retvals)
|
|
|
|
elseif e then
|
|
|
|
return "s", e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
2011-09-11 16:50:01 +02:00
|
|
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|