3 [Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
7 Shows PulseAudio volume with a progressbar; provides tooltips and notifications.
10 local volume = lain.widget.pulsebar()
15 Variable | Meaning | Type | Default
17 `timeout` | Refresh timeout (in seconds) | integer | 5
18 `settings` | User settings | function | empty function
19 `width` | Bar width | number | 63
20 `height` | Bar height | number | 1
21 `margins` | Bar margins | number | 1
22 `paddings` | Bar paddings | number | 1
23 `ticks` | Set bar ticks on | boolean | false
24 `ticks_size` | Ticks size | number | 7
25 `tick` | String for a notification tick | string | "|"
26 `tick_pre` | String for the left notification delimeter | string | "["
27 `tick_post` | String for the right notification delimeter | string | "]"
28 `tick_none` | String for an empty notification tick | string | " "
29 `scallback` | [PulseAudio sink callback](https://github.com/lcpz/lain/wiki/pulseaudio/) | function | `nil`
30 `sink` | Mixer sink | number | 0
31 `colors` | Bar colors | table | see [Default colors](https://github.com/lcpz/lain/wiki/pulsebar#default-colors)
32 `notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset)
33 `followtag` | Display the notification on currently focused screen | boolean | false
34 `notification_preset` | Notification preset | table | See [default `notification_preset`](https://github.com/lcpz/lain/wiki/pulsebar#default-notification_preset)
35 `devicetype` | PulseAudio device type | string ("sink", "source") | "sink"
36 `cmd` | PulseAudio command | string or function | see [here](https://github.com/lcpz/lain/blob/master/widget/pulsebar.lua#L48)
38 Read [pulse](https://github.com/lcpz/lain/wiki/pulse) page for `cmd` settings.
40 `settings` can use [these variables](https://github.com/lcpz/lain/wiki/pulse#settings-variables).
42 With multiple screens, the default behaviour is to show a visual notification pop-up window on the first screen. By setting `followtag` to `true` it will be shown on the currently focused tag screen.
46 Variable | Meaning | Type | Default
48 `background` | Bar backgrund color | string | "#000000"
49 `mute` | Bar mute color | string | "#EB8F8F"
50 `unmute` | Bar unmute color | string | "#A4CE8A"
52 ### Default `notification_preset`
55 notification_preset = {
62 Variable | Meaning | Type
64 `bar` | The widget | `wibox.widget.progressbar`
65 `device` | PulseAudio device | string
66 `notify` | The notification | function
67 `update` | Update state | function
68 `tooltip` | The tooltip | `awful.tooltip`
73 volume.bar:buttons(awful.util.table.join(
74 awful.button({}, 1, function() -- left click
75 awful.spawn("pavucontrol")
77 awful.button({}, 2, function() -- middle click
78 os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device))
81 awful.button({}, 3, function() -- right click
82 os.execute(string.format("pactl set-sink-mute %d toggle", volume.device))
85 awful.button({}, 4, function() -- scroll up
86 os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device))
89 awful.button({}, 5, function() -- scroll down
90 os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device))
98 Same as [here](https://github.com/lcpz/lain/wiki/pulse#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`.