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

9b5a7117b9aa6a7f092984c45b5d0565be7f2ea5
[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 `color` | Notifications color | string | `beautiful.fg_focus`
46 `bar_size` | Wibox height | int | 18
47
48 It's **crucial** to set `notifications.bar_size` to your `mywibox[s]` height,
49 **if** you have set it different than default (18). 
50
51 `lain.widgets.alsabar` outputs the following table:
52
53 Variable | Meaning | Type
54 --- | --- | ---
55 `widget` | The widget | `awful.widget.progressbar`
56 `channel` | Alsa channel | string
57 `step` | Increase/decrease step | string
58 `notify` | The notification | function
59
60 Finally, you can control the widget with key bindings like these:
61
62     -- Volume control
63     awful.key({ altkey }, "Up",
64     function ()
65         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "+")
66         volume.notify()
67     end),
68     awful.key({ altkey }, "Down",
69     function ()
70         awful.util.spawn("amixer sset " .. volume.channel .. " " .. volume.step .. "-")
71         volume.notify()
72     end),
73     awful.key({ altkey }, "m",
74     function ()
75         awful.util.spawn("amixer set Master playback toggle")
76         volume.notify()
77     end),
78     awful.key({ altkey, "Control" }, "m", 
79     function ()
80         awful.util.spawn("amixer set Master playback 100%", false )
81         volume.notify()
82     end),
83
84 where `altkey = "Mod1"`.