]> 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:

Updated To start (markdown)
[etc/awesome.git] / alsabar.md
1 Shows and controls alsa volume with a progressbar.
2
3 Dependencies:
4
5 - alsa-utils (of course)
6
7 Plus tooltips, notifications, and color changes at mute/unmute switch.
8
9         myvolumebar = lain.widgets.alsabar()
10
11 * Left click: Launch `alsamixer` in your `terminal`.
12 * Right click: Mute/unmute.
13 * Scroll wheel: Increase/decrase volume.
14
15 The function takes a table as optional argument, which can contain:
16
17 Variable | Meaning | Type | Default
18 --- | --- | --- | ---
19 `width` | Bar width | int | 63
20 `height` | Bar height | int | 1
21 `ticks` | Set bar ticks on | boolean | true
22 `ticks_size` | Ticks size | int | 7
23 `vertical` | Set the bar vertical | boolean | false
24 `channel` | Mixer channel | string | "Master" 
25 `step` | Step at which volume is increased/decreased | string | "5%"
26 `colors` | Bar colors | table | see **colors**
27 `notifications` | Notifications settings | table | see **notifications**
28
29 ### colors
30
31 Variable | Meaning | Type | Default
32 --- | --- | --- | ---
33 `background` | Bar backgrund color | string | `beautiful.bg_normal`
34 `mute` | Bar mute color | string | "#EB8F8F"
35 `unmute` | Bar unmute color | string | "#A4CE8A"
36
37 ### notifications
38
39 Variable | Meaning | Type | Default
40 --- | --- | --- | ---
41 `font` | Notifications font | string | The one defined in `beautiful.font`
42 `font_size` | Notifications font size | string | "11"
43 `bar_size` | Wibox height | int | 18
44
45 It's **crucial** to set `notifications.bar_size` to your `mywibox[s]` height,
46 **if** you have set it different than default (18). 
47
48 `lain.widgets.alsabar` outputs the following table:
49
50 Variable | Meaning | Type
51 --- | --- | ---
52 `widget` | The widget | `awful.widget.progressbar`
53 `channel` | Alsa channel | string
54 `step` | Increase/decrease step | string
55 `notify` | The notification | function
56
57 Finally, you can control the widget with key bindings like these:
58
59     -- Volume control
60     awful.key({ altkey }, "Up",
61     function ()
62         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "+")
63         volume.notify()
64     end),
65     awful.key({ altkey }, "Down",
66     function ()
67         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "-")
68         volume.notify()
69     end),
70     awful.key({ altkey }, "m",
71     function ()
72         awful.util.spawn("amixer set Master playback toggle")
73         volume.notify()
74     end),
75     awful.key({ altkey, "Control" }, "m", 
76     function ()
77         awful.util.spawn("amixer set Master playback 100%", false )
78         volume.notify()
79     end),
80
81 where `altkey = "Mod1"`.