PulseAudio widgtet for the Awesome Window Manager that uses DBus
Go to file
Stefano Mazzucco 8a357e481f Add support for sources (i.e. microphones)
The widget will to its best to detect the active source.

- Updated client code to detect source changes and add object path information to
  the volume and mute updated signals.
- Added new functions to toggle mute and change volume on the microphone. The
  functions name have `_mic` appended.
- Refactored widget code to reduce duplication.
- Updated README with examples on how to add controls for the microphone to `rc.lua`.
2017-06-02 12:12:42 +01:00
.gitignore Ignore *.rock files built by luarocks 2016-08-14 20:16:27 +01:00
LICENSE Initial commit and first public release: 0.1.0 2016-08-14 20:08:49 +01:00
README.md Add support for sources (i.e. microphones) 2017-06-02 12:12:42 +01:00
pulseaudio_widget-0.1.1-1.rockspec Release v0.1.1 2016-09-17 23:45:14 +01:00
pulseaudio_widget-0.2.0-1.rockspec Add dynamic volume/sink updates: use dbus_proxy and Awesome 4.x 2017-05-25 14:41:27 +01:00
pulseaudio_widget-0.2.1-1.rockspec Add rockspec for version 0.2.1 2017-05-25 22:26:50 +01:00
pulseaudio_widget-devel-1.rockspec Add dynamic volume/sink updates: use dbus_proxy and Awesome 4.x 2017-05-25 14:41:27 +01:00
pulseaudio_widget.lua Add support for sources (i.e. microphones) 2017-06-02 12:12:42 +01:00
pulseaudio_widget_client.lua Add support for sources (i.e. microphones) 2017-06-02 12:12:42 +01:00

README.md

A widget for the Awesome Window Manager 4.x to control the volume

A widget for the Awesome Window Manager (version 4.x) that uses pulseaudio_dbus to control your audio devices.

A note about PulseAudio, DBus and Awesome

The Pulseaudio DBus interface requires clients to use peer-to-peer connection rather than the usual system/session buses. This means that we cannot use the Awesome DBus API that supports only system and session buses.

The solution is to run an external client application to establish a peer-to-peer connection and listen to DBus signals. The output of the client is read by the widget that updates itself accordingly. This is done thanks to awful.spawn.with_line_callback.

Requirements

In addition to the requirements listed in the rockspec file, you will need the Awesome Window Manager version 4.x and PulseAudio with DBus enabled.

To enable DBus in PulseAudio, ensure that the line

load-module module-dbus-protocol

is present in /etc/pulse/default.pa or ~/.config/pulse/default.pa

Installation

The easiest way to install this widget is to use luarocks:

luarocks install pulseaudio_widget

You can use the --local option if you don't want or can't install it system-wide

This will ensure that all its dependencies are installed.

Configuration

The widget displays volume icons that are searched in the folder defined by beautiful.pulse_icon_theme with extension beautiful.pulse_icon_extension. The default is to look into "/usr/share/icons/Adwaita/scalable/status" for icons whose extension is ".svg".

Specifically, you will need icons named:

  • audio-volume-high-symbolic
  • audio-volume-medium-symbolic
  • audio-volume-low-symbolic
  • audio-volume-muted-symbolic

Mouse controls

When the widget is focused:

  • Scroll: controls the volume
  • Left button: toggles mute
  • Right button: launches mixer (mixer field of the widget table, defaults to pavucontrol)

Usage

Add the following to your ~/.config/awesome/rc.lua:

Require the module:

-- require *after* `beautiful.init` or the theme will be inconsistent!
local pulse = require("pulseaudio_widget")

Add the widget to your layout:

s.mywibox:setup {
  layout = wibox.layout.align.horizontal,
  { -- Left widgets },
  s.mytasklist, -- Middle widget
  { -- Right widgets
    pulse
  }
}

Finally add some keyboard shortcuts to control the volume:

awful.util.table.join(
  -- Audio
  awful.key({ }, "XF86AudioRaiseVolume", pulse.volume_up),
  awful.key({ }, "XF86AudioLowerVolume", pulse.volume_down),
  awful.key({ }, "XF86AudioMute",  pulse.toggle_muted),
  -- Microphone
  awful.key({"Shift"}, "XF86AudioRaiseVolume", pulse.volume_up_mic),
  awful.key({"Shift"}, "XF86AudioLowerVolume", pulse.volume_down_mic),
  awful.key({ }, "XF86MicMute",  pulse.toggle_muted_mic),
)

Credits

This program was inspired by the Awesome Pulseaudio Widget (APW).