2017-05-25 15:41:27 +02:00
|
|
|
# A widget for the Awesome Window Manager 4.x to control the volume
|
2016-08-12 23:04:59 +02:00
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
A widget for the Awesome Window Manager (version 4.x) that
|
|
|
|
uses [pulseaudio_dbus](https://github.com/stefano-m/lua-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`](https://awesomewm.org/apidoc/libraries/awful.spawn.html#with_line_callback).
|
2016-08-12 23:04:59 +02:00
|
|
|
|
|
|
|
# Requirements
|
|
|
|
|
|
|
|
In addition to the requirements listed in the `rockspec` file, you will need
|
2017-05-25 15:41:27 +02:00
|
|
|
the [Awesome Window Manager](https://awesomewm.org) *version 4.x* and
|
|
|
|
PulseAudio with DBus enabled.
|
2016-08-12 23:04:59 +02:00
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
To enable DBus in PulseAudio, ensure that the line
|
2016-08-12 23:04:59 +02:00
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
load-module module-dbus-protocol
|
2016-08-12 23:04:59 +02:00
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
is present in `/etc/pulse/default.pa` or `~/.config/pulse/default.pa`
|
2016-08-12 23:04:59 +02:00
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
# Installation
|
|
|
|
|
|
|
|
The easiest way to install this widget is to use `luarocks`:
|
2016-08-12 23:04:59 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
The widget displays volume icons that are searched in the folder defined by
|
|
|
|
`beautiful.pulse_icon_theme` with extension `beautiful.pulse_icon_extension`.
|
2016-08-12 23:04:59 +02:00
|
|
|
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
|
2017-05-25 15:41:27 +02:00
|
|
|
* Right button: launches mixer (`mixer` field of the widget table, defaults to
|
|
|
|
`pavucontrol`)
|
2016-08-12 23:04:59 +02:00
|
|
|
|
|
|
|
# Usage
|
2017-05-25 15:41:27 +02:00
|
|
|
|
2016-08-12 23:04:59 +02:00
|
|
|
Add the following to your `~/.config/awesome/rc.lua`:
|
|
|
|
|
|
|
|
Require the module:
|
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
``` lua
|
|
|
|
-- require *after* `beautiful.init` or the theme will be inconsistent!
|
|
|
|
local pulse = require("pulseaudio_widget")
|
|
|
|
|
|
|
|
```
|
2016-08-12 23:04:59 +02:00
|
|
|
|
|
|
|
Add the widget to your layout:
|
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
``` lua
|
|
|
|
s.mywibox:setup {
|
|
|
|
layout = wibox.layout.align.horizontal,
|
|
|
|
{ -- Left widgets },
|
|
|
|
s.mytasklist, -- Middle widget
|
|
|
|
{ -- Right widgets
|
|
|
|
pulse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2016-08-12 23:04:59 +02:00
|
|
|
|
|
|
|
Finally add some keyboard shortcuts to control the volume:
|
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
``` lua
|
|
|
|
awful.util.table.join(
|
|
|
|
awful.key({ }, "XF86AudioRaiseVolume", pulse.volume_up),
|
|
|
|
awful.key({ }, "XF86AudioLowerVolume", pulse.volume_down),
|
|
|
|
awful.key({ }, "XF86AudioMute", pulse.toggle_muted)
|
|
|
|
)
|
|
|
|
```
|
2016-11-21 23:54:36 +01:00
|
|
|
|
2016-08-12 23:04:59 +02:00
|
|
|
# Credits
|
|
|
|
|
2017-05-25 15:41:27 +02:00
|
|
|
This program was inspired by
|
|
|
|
the [Awesome Pulseaudio Widget (APW)](https://github.com/mokasin/apw).
|