awesome-wm-widgets/volume-widget/README.md

91 lines
3.1 KiB
Markdown
Raw Normal View History

2017-02-02 03:25:25 +01:00
# Volume widget
2019-12-15 21:55:38 +01:00
Simple and easy-to-install widget for Awesome Window Manager which shows the sound level: ![Volume Widget](./vol-widget-1.png)
2017-02-02 03:25:25 +01:00
2017-02-02 03:45:15 +01:00
Note that widget uses the Arc icon theme, so it should be [installed](https://github.com/horst3180/arc-icon-theme#installation) first under **/usr/share/icons/Arc/** folder.
2019-09-04 03:57:24 +02:00
## Customization
It is possible to customize widget by providing a table with all or some of the following config parameters:
| Name | Default | Description |
|---|---|---|
| `volume_audio_controller` | `pulse` | audio device |
| `notification` | `false` | Display a notification on mouseover |
| `notification_position` | `top_right` | The notification position |
2019-09-04 03:57:24 +02:00
2017-02-02 03:25:25 +01:00
## Installation
- clone/copy **volume.lua** file;
- include `volume.lua` and add volume widget to your wibox in rc.lua:
```lua
require("volume")
...
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
2019-09-04 03:57:24 +02:00
volume_widget(),
...
2017-02-02 03:25:25 +01:00
```
2017-06-17 18:45:58 +02:00
- _Optional step._ In Arc icon theme the muted audio level icon (![Volume-widget](./audio-volume-muted-symbolic.png)) looks like 0 level icon, which could be a bit misleading.
So I decided to use original muted icon for low audio level, and the same icon, but colored in red for muted audio level. Fortunately icons are in svg format, so you can easily recolor them with `sed`, so it would look like this (![Volume Widget](./audio-volume-muted-symbolic_red.png)):
2017-06-09 22:07:31 +02:00
```bash
cd /usr/share/icons/Arc/status/symbolic &&
sudo cp audio-volume-muted-symbolic.svg audio-volume-muted-symbolic_red.svg &&
sudo sed -i 's/bebebe/ed4737/g' ./audio-volume-muted-symbolic_red.svg
2017-06-09 22:07:31 +02:00
```
2017-02-02 03:25:25 +01:00
### Pulse or ALSA only
Try running this command:
2019-09-04 03:57:24 +02:00
```bash
amixer -D pulse sget Master
```
If that prints something like this, then the default setting of 'pulse' is probably fine:
2019-09-04 03:57:24 +02:00
```
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 64
Mono: Playback 64 [100%] [0.00dB] [on]
```
If it prints something like this:
2019-09-04 03:57:24 +02:00
```bash
$ amixer -D pulse sget Master
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
amixer: Mixer attach pulse error: Connection refused
```
2019-09-04 03:57:24 +02:00
then set `volume_audio_controller` to `alsa_only` in widget constructor:
```lua
volume_widget({
volume_audio_controller = 'alsa_only'
})
```
.
2017-02-02 03:25:25 +01:00
## Control volume
2017-02-10 03:57:39 +01:00
To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget.
2017-02-10 03:56:09 +01:00
2017-02-10 03:57:39 +01:00
If you want to control volume level by keyboard shortcuts add following lines in shortcut section of the **rc.lua** (the commands could be slightly different depending on your PC configuration):
2018-11-01 01:54:48 +01:00
2017-02-02 03:25:25 +01:00
```lua
awful.key({ modkey}, "[", function () awful.spawn("amixer -D pulse sset Master 5%+") end, {description = "increase volume", group = "custom"}),
awful.key({ modkey}, "]", function () awful.spawn("amixer -D pulse sset Master 5%-") end, {description = "decrease volume", group = "custom"}),
2017-06-17 18:45:58 +02:00
awful.key({ modkey}, "\", function () awful.spawn("amixer -D pulse set Master +1 toggle") end, {description = "mute volume", group = "custom"}),
2017-02-02 03:26:31 +01:00
```