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