]> 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 Utilities (markdown)
[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_normal`
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 following variables:
47
48 Variable | Meaning | Type | Values
49 --- | --- | --- | ---
50 `volume_now.level` | Self explained | int | 0-100
51 `volume_now.status` | Device status | string | "on", "off"
52 ### output table
53
54 Variable | Meaning | Type
55 --- | --- | ---
56 `bar` | The widget | `awful.widget.progressbar`
57 `channel` | Alsa channel | string
58 `step` | Increase/decrease step | string
59 `notify` | The notification | function
60
61 You can control the widget with key bindings like these:
62
63     -- ALSA volume control
64     awful.key({ altkey }, "Up",
65         function ()
66             awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "+")
67             volume.notify()
68         end),
69     awful.key({ altkey }, "Down",
70         function ()
71             awful.util.spawn("amixer -q set " .. volume.channel .. " " .. volume.step .. "-")
72             volume.notify()
73         end),
74     awful.key({ altkey }, "m",
75         function ()
76             awful.util.spawn("amixer -q set " .. volume.channel .. " playback toggle")
77             volume.notify()
78         end),
79     awful.key({ altkey, "Control" }, "m",
80         function ()
81             awful.util.spawn("amixer -q set " .. volume.channel .. " playback 100%")
82             volume.notify()
83         end),
84
85 where `altkey = "Mod1"`.