]> git.madduck.net Git - etc/awesome.git/blob - alsa.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:

Updated mpd (markdown)
[etc/awesome.git] / alsa.md
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2
3 Shows and controls alsa volume with a textbox.
4
5         myvolume = lain.widgets.alsa()
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 `channel` | Mixer channel | string | "Master" 
16 `step` | Step at which volume is increased/decreased | string | "1%"
17 `header` | Text to show before value | string | " Vol "
18 `header_color` | Header color | string | `beautiful.fg_normal` or "#FFFFFF"
19 `color` | Value color | string | `beautiful.fg_focus` or "#FFFFFF"
20 `footer` | Text to append after value | string | " "
21
22 *Note*: `footer` can be markup text.
23
24 `lain.widgets.alsa` outputs the following table:
25
26 Variable | Meaning | Type
27 --- | --- | --- 
28 `widget` | The widget | `wibox.widget.textbox`
29 `channel` | Alsa channel | string
30 `step` | Increase/decrease step | string
31 `notify` | Update `widget` | function
32
33 Finally, you can control the widget with key bindings like these:
34
35     -- Volume control
36     awful.key({ altkey }, "Up",
37     function ()
38         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "+")
39         volume.notify()
40     end),
41     awful.key({ altkey }, "Down",
42     function ()
43         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "-")
44         volume.notify()
45     end),
46     awful.key({ altkey }, "m",
47     function ()
48         awful.util.spawn("amixer set Master playback toggle")
49         volume.notify()
50     end),
51     awful.key({ altkey, "Control" }, "m", 
52     function ()
53         awful.util.spawn("amixer set Master playback 100%", false )
54         volume.notify()
55     end),
56
57 where `altkey = "Mod1"`.