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.
7 - alsa-utils (of course)
9 Plus tooltips, notifications, and color changes at mute/unmute switch.
11 myvolumebar = lain.widgets.alsabar()
13 * Left click: Launch `alsamixer` in your `terminal`.
14 * Right click: Mute/unmute.
15 * Scroll wheel: Increase/decrase volume.
17 The function takes a table as optional argument, which can contain:
19 Variable | Meaning | Type | Default
21 `width` | Bar width | int | 63
22 `height` | Bar height | int | 1
23 `ticks` | Set bar ticks on | boolean | true
24 `ticks_size` | Ticks size | int | 7
25 `vertical` | Set the bar vertical | boolean | false
26 `channel` | Mixer channel | string | "Master"
27 `step` | Step at which volume is increased/decreased | string | "5%"
28 `colors` | Bar colors | table | see **colors**
29 `notifications` | Notifications settings | table | see **notifications**
33 Variable | Meaning | Type | Default
35 `background` | Bar backgrund color | string | `beautiful.bg_normal`
36 `mute` | Bar mute color | string | "#EB8F8F"
37 `unmute` | Bar unmute color | string | "#A4CE8A"
41 Variable | Meaning | Type | Default
43 `font` | Notifications font | string | The one defined in `beautiful.font`
44 `font_size` | Notifications font size | string | "11"
45 `color` | Notifications color | string | `beautiful.fg_focus`
46 `bar_size` | Wibox height | int | 18
48 It's **crucial** to set `notifications.bar_size` to your `mywibox[s]` height,
49 **if** you have set it different than default (18).
51 `lain.widgets.alsabar` outputs the following table:
53 Variable | Meaning | Type
55 `widget` | The widget | `awful.widget.progressbar`
56 `channel` | Alsa channel | string
57 `step` | Increase/decrease step | string
58 `notify` | The notification | function
60 Finally, you can control the widget with key bindings like these:
63 awful.key({ altkey }, "Up",
65 awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "+")
68 awful.key({ altkey }, "Down",
70 awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "-")
73 awful.key({ altkey }, "m",
75 awful.util.spawn("amixer set Master playback toggle")
78 awful.key({ altkey, "Control" }, "m",
80 awful.util.spawn("amixer set Master playback 100%", false )
84 where `altkey = "Mod1"`.