massive update, probably broken
[dotfiles/.git] / .config / awesome / lain / wiki / pulsebar.md
1 ## Usage
2
3 [Read here.](https://github.com/lcpz/lain/wiki/Widgets#usage)
4
5 ### Description
6
7 Shows PulseAudio volume with a progressbar; provides tooltips and notifications.
8
9 ```lua
10 local volume = lain.widget.pulsebar()
11 ```
12
13 ## Input table
14
15 Variable | Meaning | Type | Default
16 --- | --- | --- | ---
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)
37
38 Read [pulse](https://github.com/lcpz/lain/wiki/pulse) page for `cmd` settings.
39
40 `settings` can use [these variables](https://github.com/lcpz/lain/wiki/pulse#settings-variables).
41
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.
43
44 ### Default colors
45
46 Variable | Meaning | Type | Default
47 --- | --- | --- | ---
48 `background` | Bar backgrund color | string | "#000000"
49 `mute` | Bar mute color | string | "#EB8F8F"
50 `unmute` | Bar unmute color | string | "#A4CE8A"
51
52 ### Default `notification_preset`
53
54 ```lua
55 notification_preset = {
56     font = "Monospace 10"
57 }
58 ```
59
60 ## Output table
61
62 Variable | Meaning | Type
63 --- | --- | ---
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`
69
70 ## Buttons
71
72 ```lua
73 volume.bar:buttons(awful.util.table.join(
74     awful.button({}, 1, function() -- left click
75         awful.spawn("pavucontrol")
76     end),
77     awful.button({}, 2, function() -- middle click
78         os.execute(string.format("pactl set-sink-volume %d 100%%", volume.device))
79         volume.update()
80     end),
81     awful.button({}, 3, function() -- right click
82         os.execute(string.format("pactl set-sink-mute %d toggle", volume.device))
83         volume.update()
84     end),
85     awful.button({}, 4, function() -- scroll up
86         os.execute(string.format("pactl set-sink-volume %d +1%%", volume.device))
87         volume.update()
88     end),
89     awful.button({}, 5, function() -- scroll down
90         os.execute(string.format("pactl set-sink-volume %d -1%%", volume.device))
91         volume.update()
92     end)
93 ))
94 ```
95
96 ## Keybindings
97
98 Same as [here](https://github.com/lcpz/lain/wiki/pulse#keybindings). If you want notifications, use `volume.notify()` instead of `volume.update()`.