lain/alsa.md

53 lines
1.4 KiB
Markdown
Raw Normal View History

2013-09-07 14:35:43 +02:00
[<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2013-09-07 14:15:53 +02:00
Shows and controls alsa volume with a textbox.
2013-09-07 12:39:52 +02:00
2013-09-12 18:37:35 +02:00
volumewidget = lain.widgets.alsa()
2013-09-07 12:39:52 +02:00
2013-09-10 22:25:23 +02:00
### input table
2013-09-07 12:39:52 +02:00
Variable | Meaning | Type | Default
--- | --- | --- | ---
2013-09-10 22:25:23 +02:00
`timeout` | Refresh timeout seconds | int | 5
2013-09-07 12:39:52 +02:00
`channel` | Mixer channel | string | "Master"
2013-09-10 22:25:23 +02:00
`settings` | User settings | function | empty function
2013-09-10 23:00:59 +02:00
`settings` can use the following variables:
2013-09-07 12:39:52 +02:00
2013-09-10 22:25:23 +02:00
Variable | Meaning | Type | Values
--- | --- | --- | ---
2013-09-12 18:37:54 +02:00
`volume_now.level` | Self explained | int | 0-100
`volume_now.status` | Device status | string | "on", "off"
2013-09-09 13:52:53 +02:00
2013-09-10 22:25:23 +02:00
### output table
2013-09-07 12:39:52 +02:00
2013-09-07 13:18:36 +02:00
Variable | Meaning | Type
--- | --- | ---
`widget` | The widget | `wibox.widget.textbox`
2013-09-11 18:39:38 +02:00
`update` | Update `widget` | function
2013-09-07 12:39:52 +02:00
2013-09-10 22:29:07 +02:00
You can control the widget with key bindings like these:
2013-09-07 12:39:52 +02:00
2013-09-07 13:35:37 +02:00
-- Volume control
awful.key({ altkey }, "Up",
function ()
2013-09-11 18:40:33 +02:00
awful.util.spawn("amixer set Master 1%+")
2013-09-12 18:37:19 +02:00
volumewidget.update()
2013-09-07 13:35:37 +02:00
end),
awful.key({ altkey }, "Down",
function ()
2013-09-11 18:40:33 +02:00
awful.util.spawn("amixer set Master 1%-")
2013-09-12 18:37:19 +02:00
volumewidget.update()
2013-09-07 13:35:37 +02:00
end),
awful.key({ altkey }, "m",
function ()
awful.util.spawn("amixer set Master playback toggle")
2013-09-12 18:37:19 +02:00
volumewidget.update()
2013-09-07 13:35:37 +02:00
end),
awful.key({ altkey, "Control" }, "m",
function ()
awful.util.spawn("amixer set Master playback 100%", false )
2013-09-12 18:37:19 +02:00
volumewidget.update()
2013-09-07 13:35:37 +02:00
end),
2013-09-07 12:39:52 +02:00
where `altkey = "Mod1"`.