2013-09-07 14:35:32 +02:00
|
|
|
[<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
|
|
|
|
|
2013-09-12 17:04:28 +02:00
|
|
|
Shows and controls alsa volume with a progressbar; provides tooltips, notifications, and color changes at mute/unmute switch.
|
2013-09-07 12:37:03 +02:00
|
|
|
|
|
|
|
myvolumebar = lain.widgets.alsabar()
|
|
|
|
|
|
|
|
* Left click: Launch `alsamixer` in your `terminal`.
|
|
|
|
* Right click: Mute/unmute.
|
|
|
|
* Scroll wheel: Increase/decrase volume.
|
|
|
|
|
|
|
|
The function takes a table as optional argument, which can contain:
|
|
|
|
|
|
|
|
Variable | Meaning | Type | Default
|
|
|
|
--- | --- | --- | ---
|
2013-09-12 17:04:28 +02:00
|
|
|
`timeout` | Refresh timeout seconds | int | 4
|
2013-09-07 12:37:03 +02:00
|
|
|
`width` | Bar width | int | 63
|
|
|
|
`height` | Bar height | int | 1
|
|
|
|
`ticks` | Set bar ticks on | boolean | true
|
|
|
|
`ticks_size` | Ticks size | int | 7
|
|
|
|
`vertical` | Set the bar vertical | boolean | false
|
|
|
|
`channel` | Mixer channel | string | "Master"
|
|
|
|
`step` | Step at which volume is increased/decreased | string | "5%"
|
|
|
|
`colors` | Bar colors | table | see **colors**
|
|
|
|
`notifications` | Notifications settings | table | see **notifications**
|
|
|
|
|
|
|
|
### colors
|
|
|
|
|
|
|
|
Variable | Meaning | Type | Default
|
|
|
|
--- | --- | --- | ---
|
|
|
|
`background` | Bar backgrund color | string | `beautiful.bg_normal`
|
|
|
|
`mute` | Bar mute color | string | "#EB8F8F"
|
|
|
|
`unmute` | Bar unmute color | string | "#A4CE8A"
|
|
|
|
|
|
|
|
### notifications
|
|
|
|
|
|
|
|
Variable | Meaning | Type | Default
|
|
|
|
--- | --- | --- | ---
|
|
|
|
`font` | Notifications font | string | The one defined in `beautiful.font`
|
|
|
|
`font_size` | Notifications font size | string | "11"
|
2013-09-09 01:51:10 +02:00
|
|
|
`color` | Notifications color | string | `beautiful.fg_focus`
|
2013-09-07 12:37:03 +02:00
|
|
|
`bar_size` | Wibox height | int | 18
|
|
|
|
|
|
|
|
It's **crucial** to set `notifications.bar_size` to your `mywibox[s]` height,
|
|
|
|
**if** you have set it different than default (18).
|
|
|
|
|
2013-09-10 22:28:54 +02:00
|
|
|
### output table
|
2013-09-07 12:37:03 +02:00
|
|
|
|
2013-09-07 13:19:48 +02:00
|
|
|
Variable | Meaning | Type
|
|
|
|
--- | --- | ---
|
|
|
|
`widget` | The widget | `awful.widget.progressbar`
|
|
|
|
`channel` | Alsa channel | string
|
|
|
|
`step` | Increase/decrease step | string
|
|
|
|
`notify` | The notification | function
|
2013-09-07 12:37:03 +02:00
|
|
|
|
2013-09-10 22:28:54 +02:00
|
|
|
You can control the widget with key bindings like these:
|
2013-09-07 12:37:03 +02:00
|
|
|
|
2013-09-07 13:34:31 +02:00
|
|
|
-- Volume control
|
|
|
|
awful.key({ altkey }, "Up",
|
|
|
|
function ()
|
2013-09-11 18:41:14 +02:00
|
|
|
awful.util.spawn("amixer set " .. volume.channel .. " " .. volume.step .. "+")
|
2013-09-07 13:34:31 +02:00
|
|
|
volume.notify()
|
|
|
|
end),
|
|
|
|
awful.key({ altkey }, "Down",
|
|
|
|
function ()
|
2013-09-11 18:41:14 +02:00
|
|
|
awful.util.spawn("amixer set " .. volume.channel .. " " .. volume.step .. "-")
|
2013-09-07 13:34:31 +02:00
|
|
|
volume.notify()
|
|
|
|
end),
|
|
|
|
awful.key({ altkey }, "m",
|
|
|
|
function ()
|
2013-09-12 18:07:46 +02:00
|
|
|
awful.util.spawn("amixer set " .. volume.channel .. " playback toggle")
|
2013-09-07 13:34:31 +02:00
|
|
|
volume.notify()
|
|
|
|
end),
|
|
|
|
awful.key({ altkey, "Control" }, "m",
|
|
|
|
function ()
|
2013-09-12 18:07:46 +02:00
|
|
|
awful.util.spawn("amixer set " .. volume.channel .. " playback 100%", false )
|
2013-09-07 13:34:31 +02:00
|
|
|
volume.notify()
|
2013-09-07 13:34:48 +02:00
|
|
|
end),
|
2013-09-07 12:37:03 +02:00
|
|
|
|
|
|
|
where `altkey = "Mod1"`.
|