Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion awesome/dbus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,15 @@ function dbus.disconnect_signal(name, callback)
end
end

function dbus.emit_signal(bus_name, path, iface, name, ...)
function dbus.emit_signal(bus_name, dest, path, iface, name, ...)
local args = {...}
local bus = dbus.get_bus(bus_name)
if not bus then return false end
local msg = ldbus.message.new_signal(path, iface, name)
if not msg then return false end
if dest then
msg:set_destination(dest)
end
local iter = msg:iter_init_append()
if not iter then return false end
for i=1,#args,2 do
Expand Down
11 changes: 11 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ function dbus.off(name, callback, opts)
end


function dbus.signal(name, opts)
if not dbus.raw.emit_signal then return end
opts = opts or {}
opts.bus = opts.bus or "session"
return dbus.raw.emit_signal(
opts.bus, opts.destination, opts.path, opts.interface, name,
unpack(opts.args or {})
)
end


function dbus.call(name, callback, opts)
if not dbus.raw.call_method then return end
if callback and type(callback) ~= 'function' then
Expand Down