Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefano-m/lua-pulseaudio_dbus
Control PulseAudio devices using DBus
https://github.com/stefano-m/lua-pulseaudio_dbus
dbus lua pulseaudio
Last synced: about 2 months ago
JSON representation
Control PulseAudio devices using DBus
- Host: GitHub
- URL: https://github.com/stefano-m/lua-pulseaudio_dbus
- Owner: stefano-m
- License: apache-2.0
- Created: 2016-08-12T23:13:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-10-15T13:55:03.000Z (about 2 years ago)
- Last Synced: 2024-07-14T00:24:10.125Z (6 months ago)
- Topics: dbus, lua, pulseaudio
- Language: Lua
- Homepage: https://stefano-m.github.io/lua-pulseaudio_dbus/
- Size: 57.6 KB
- Stars: 14
- Watchers: 3
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build
Status](https://travis-ci.com/stefano-m/lua-pulseaudio_dbus.svg?branch=master)](https://travis-ci.com/stefano-m/lua-pulseaudio_dbus) [![codecov](https://codecov.io/gh/stefano-m/lua-pulseaudio_dbus/branch/master/graph/badge.svg?token=9aDWXISb6X)](https://codecov.io/gh/stefano-m/lua-pulseaudio_dbus)# Control PulseAudio using DBus
This module provides a simple API to control
[PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/)
using [DBus](http://dbus.freedesktop.org/).# Introduction
Seeking to learn some [Lua](http://www.lua.org), and customize my
[Awesome Window Manager](https://awesomewm.org), I have started to dig into
DBus in an attempt to avoid using terminal commands and parsing their outputs.# Requirements
For this module to work, you need PulseAudio with DBus support enabled.
You need to ensure that the DBus module is loaeded by PulseAudio by adding the
following to your `/etc/pulse/default.pa` (or `~/.config/pulse/default.pa` to
set it up at the user level)..ifexists module-dbus-protocol.so
load-module module-dbus-protocol
.endifIf the module is not present or not loaded, this module will not work.
# Installation
## Luarocks
This module can be installed with [Luarocks](http://luarocks.org/) by running
luarocks install pulseaudio_dbus
Use the `--local` option in `luarocks` if you don't want or can't install it
system-wide.## NixOS
If you are on NixOS, you can install this package from
[nix-stefano-m-overlays](https://github.com/stefano-m/nix-stefano-m-nix-overlays).# Example
Below is a small example of how to use the module:
pulse = require("pulseaudio_dbus")
address = pulse.get_address()
connection = pulse.get_connection(address)
core = pulse.get_core(connection)
sink = pulse.get_device(connection, core:get_sinks()[1])
sink:set_muted(true)
sink:toggle_muted()
assert(not sink:is_muted())
sink:set_volume_percent({75}) -- sets the volume to 75%# Documentation
The documentation of this module is built using [LDoc](https://stevedonovan.github.io/ldoc/).
A copy of the documentation is already provided in the `docs` folder,
but you can build it from source by running `ldoc .` in the root of the repository.