-
Notifications
You must be signed in to change notification settings - Fork 209
alsa
Luke Bonham edited this page Jan 17, 2016
·
58 revisions
Shows and controls ALSA volume with a textbox.
volumewidget = lain.widgets.alsa()
Variable | Meaning | Type | Default |
---|---|---|---|
timeout |
Refresh timeout seconds | int | 5 |
cmd |
Alsa mixer command | string | "amixer" |
channel |
Mixer channel | string | "Master" |
settings |
User settings | function | empty function |
cmd
is useful if you need to pass additional arguments to amixer. For instance, users with multiple sound cards may define cmd = "amixer -c X"
in order to set amixer with card X
.
settings
can use the following variables:
Variable | Meaning | Type | Values |
---|---|---|---|
volume_now.level |
Volume level | int | 0-100 |
volume_now.status |
Device status | string | "on", "off" |
Variable | Meaning | Type |
---|---|---|
widget |
The widget | wibox.widget.textbox |
channel |
Alsa channel | string |
update |
Update widget
|
function |
You can control the widget with key bindings like these:
-- ALSA volume control
awful.key({ altkey }, "Up",
function ()
os.execute(string.format("amixer set %s 1%%+", volumewidget.channel))
volumewidget.update()
end),
awful.key({ altkey }, "Down",
function ()
os.execute(string.format("amixer set %s 1%%-", volumewidget.channel))
volumewidget.update()
end),
awful.key({ altkey }, "m",
function ()
os.execute(string.format("amixer set %s toggle", volumewidget.channel))
volumewidget.update()
end),
awful.key({ altkey, "Control" }, "m",
function ()
os.execute(string.format("amixer set %s 100%%", volumewidget.channel))
volumewidget.update()
end),
where altkey = "Mod1"
.
Problems unmuting PCM? Check here.