]> git.madduck.net Git - etc/awesome.git/blob - alsabar.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

39506b0b8ad0563783b086e1dc66956e34320f3d
[etc/awesome.git] / alsabar.md
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2
3 Shows and controls alsa volume with a progressbar; provides tooltips, notifications, and color changes at mute/unmute switch.
4
5         volume = lain.widgets.alsabar()
6
7 * Left click: Launch `alsamixer` in your `terminal`.
8 * Right click: Mute/unmute.
9 * Scroll wheel: Increase/decrase volume.
10
11 The function takes a table as optional argument, which can contain:
12
13 Variable | Meaning | Type | Default
14 --- | --- | --- | ---
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**
26
27 ### colors
28
29 Variable | Meaning | Type | Default
30 --- | --- | --- | ---
31 `background` | Bar backgrund color | string | `beautiful.bg_normal`
32 `mute` | Bar mute color | string | "#EB8F8F"
33 `unmute` | Bar unmute color | string | "#A4CE8A"
34
35 ### notifications
36
37 Variable | Meaning | Type | Default
38 --- | --- | --- | ---
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
43
44 It's **crucial** to set `notifications.bar_size` to your `mywibox[s]` height.
45
46 `settings` can use the integer `alsa_level` and `alsa_status`.
47
48 ### output table
49
50 Variable | Meaning | Type
51 --- | --- | ---
52 `bar` | The widget | `awful.widget.progressbar`
53 `channel` | Alsa channel | string
54 `step` | Increase/decrease step | string
55 `notify` | The notification | function
56
57 You can control the widget with key bindings like these:
58
59     -- ALSA volume control
60     awful.key({ altkey }, "Up",
61         function ()
62             awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "+")
63             volume.notify()
64         end),
65     awful.key({ altkey }, "Down",
66         function ()
67             awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "-")
68             volume.notify()
69         end),
70     awful.key({ altkey }, "m",
71         function ()
72             awful.util.spawn("amixer -q set " .. volume.channel .. " playback toggle")
73             volume.notify()
74         end),
75     awful.key({ altkey, "Control" }, "m",
76         function ()
77             awful.util.spawn("amixer -q set " .. volume.channel .. " playback 100%")
78             volume.notify()
79         end),
80
81 where `altkey = "Mod1"`.