]> 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 fs (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
21 and outputs the following table:
22
23 Variable | Meaning | Type
24 --- | --- | --- 
25 `widget` | The widget | `wibox.widget.textbox`
26 `channel` | Alsa channel | string
27 `step` | Increase/decrease step | string
28 `notify` | Update `widget` | function
29
30 Finally, you can control the widget with key bindings like these:
31
32     -- Volume control
33     awful.key({ altkey }, "Up",
34     function ()
35         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "+")
36         volume.notify()
37     end),
38     awful.key({ altkey }, "Down",
39     function ()
40         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "-")
41         volume.notify()
42     end),
43     awful.key({ altkey }, "m",
44     function ()
45         awful.util.spawn("amixer set Master playback toggle")
46         volume.notify()
47     end),
48     awful.key({ altkey, "Control" }, "m", 
49     function ()
50         awful.util.spawn("amixer set Master playback 100%", false )
51         volume.notify()
52     end),
53
54 where `altkey = "Mod1"`.