| 1 | BSD volume widget |
| 2 | ================= |
| 3 | |
| 4 | This widget uses mixer to get and set the current volume level and it also |
| 5 | exports functions you can use in keybindings to change the volume of your |
| 6 | soundcard. |
| 7 | |
| 8 | To add this widget to your configuration, insert |
| 9 | |
| 10 | ```lua |
| 11 | local volume = require("obvious.volume_freebsd") |
| 12 | ``` |
| 13 | |
| 14 | into the top of your rc.lua and add `obvious.volume_freebsd()` to your wibox. |
| 15 | |
| 16 | Optionally you can specify the channel to be controlled like this: |
| 17 | |
| 18 | ```lua |
| 19 | volume(channel) |
| 20 | ``` |
| 21 | |
| 22 | the default channel is "vol", you might need to set it to "pcm". |
| 23 | |
| 24 | The following functions can be used to raise/lower the volume of a soundcard |
| 25 | and to mute it: |
| 26 | |
| 27 | * `volume.raise(channel, v)` where `v` is optional and the value to raise the volume by (1 is the default) |
| 28 | * `volume.lower(channel, v)` where `v` is optional and the value to lower the volume by (1 is the default) |
| 29 | |
| 30 | Scrolling up and down on a widget changes the volume by 1. If you hold the |
| 31 | `Control` key while scrolling, the volume is changed by 5 and if you hold |
| 32 | `Shift`, it is changed by 10. |
| 33 | |
| 34 | If you want to use the data gathered by this widget, you can use the function |
| 35 | |
| 36 | ```lua |
| 37 | volume.get_data(channel) |
| 38 | ``` |
| 39 | |
| 40 | It returns nil on failure, otherwise it returns a table with the following fields: |
| 41 | |
| 42 | * `volume`: a number representing the current volume from 0 to 100 |