All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
3 Shows and controls alsa volume with a progressbar; provides tooltips, notifications, and color changes at mute/unmute switch.
5 volume = lain.widgets.alsabar()
7 * Left click: Launch `alsamixer` in your `terminal`.
8 * Right click: Mute/unmute.
9 * Scroll wheel: Increase/decrase volume.
11 The function takes a table as optional argument, which can contain:
13 Variable | Meaning | Type | Default
15 `timeout` | Refresh timeout seconds | int | 4
16 `settings` | User settings | function | empty function
17 `width` | Bar width | int | 63
18 `height` | Bar height | int | 1
19 `ticks` | Set bar ticks on | boolean | true
20 `ticks_size` | Ticks size | int | 7
21 `vertical` | Set the bar vertical | boolean | false
22 `channel` | Mixer channel | string | "Master"
23 `step` | Step at which volume is increased/decreased | string | "5%"
24 `colors` | Bar colors | table | see **colors**
25 `notifications` | Notifications settings | table | see **notifications**
29 Variable | Meaning | Type | Default
31 `background` | Bar backgrund color | string | `beautiful.bg_normal`
32 `mute` | Bar mute color | string | "#EB8F8F"
33 `unmute` | Bar unmute color | string | "#A4CE8A"
37 Variable | Meaning | Type | Default
39 `font` | Notifications font | string | The one defined in `beautiful.font`
40 `font_size` | Notifications font size | string | "11"
41 `color` | Notifications color | string | `beautiful.fg_focus`
42 `bar_size` | Wibox height | int | 18
44 It's **crucial** to set `notifications.bar_size` to your `mywibox[s]` height.
46 `settings` can use the following variables:
48 Variable | Meaning | Type | Values
50 `volume_now.level` | Self explained | int | 0-100
51 `volume_now.status` | Device status | string | "on", "off"
54 Variable | Meaning | Type
56 `bar` | The widget | `awful.widget.progressbar`
57 `channel` | Alsa channel | string
58 `step` | Increase/decrease step | string
59 `notify` | The notification | function
61 You can control the widget with key bindings like these:
63 -- ALSA volume control
64 awful.key({ altkey }, "Up",
66 awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "+")
69 awful.key({ altkey }, "Down",
71 awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "-")
74 awful.key({ altkey }, "m",
76 awful.util.spawn("amixer -q set " .. volume.channel .. " playback toggle")
79 awful.key({ altkey, "Control" }, "m",
81 awful.util.spawn("amixer -q set " .. volume.channel .. " playback 100%")
85 where `altkey = "Mod1"`.