Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cholin/lua-dbus

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convenient dbus api in lua.

Works in awesome or with ldbus.

usage

local dbus = require 'lua-dbus'

if not awesome then dbus.init() end


local function on_signal (...)
    -- react on signal here
end

local signal_opts = {
    bus = 'session' or 'system',
    interface = 'org.freedesktop.DBus', -- or something appropriate ;)
}
-- add signal handler
dbus.on('Signal', on_signal, signal_opts)

-- remove signal handler
dbus.off('Signal', on_signal, signal_opts)

-- call a method
dbus.call('Method', function (...)
    -- react on method return results here
end, {
    bus = 'session' or 'system',
    path = '/some/dbus/path', -- change this!
    interface = signal_opts.interface,
    -- just luckily matches here for demonstration purpose
    destination = signal_opts.interface,
})


-- when running
if not awesome then
    while true do
        dbus.poll()
    end
end

-- when you're done
if not awesome then dbus.exit() end

About

convenient dbus api in lua

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Lua 100.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.