alsa{bar}: add togglechannel back

This commit is contained in:
copycat-killer 2017-01-23 17:58:35 +01:00
parent ff61857e15
commit 156515eb28
3 changed files with 19 additions and 4 deletions

View File

@ -8,6 +8,7 @@
--]]
local helpers = require("lain.helpers")
local shell = require("awful.util").shell
local wibox = require("wibox")
local string = { match = string.match,
format = string.format }
@ -22,9 +23,16 @@ local function worker(args)
local timeout = args.timeout or 5
local settings = args.settings or function() end
alsa.cmd = args.cmd or "amixer"
alsa.channel = args.channel or "Master"
alsa.last = {}
alsa.cmd = args.cmd or "amixer"
alsa.channel = args.channel or "Master"
alsa.togglechannel = args.togglechannel
if alsa.togglechannel then
alsa.cmd = { shell, "-c", string.format("%s get %s; %s get %s",
alsa.cmd, alsa.channel, alsa.cmd, alsa.togglechannel) }
end
alsa.last = {}
function alsa.update()
helpers.async(alsa.cmd, function(mixer)
@ -39,6 +47,7 @@ local function worker(args)
end
timer_id = string.format("alsa-%s-%s", alsa.cmd, alsa.channel)
helpers.newtimer(timer_id, timeout, alsa.update)
return alsa

View File

@ -44,6 +44,7 @@ local function worker(args)
alsabar.cmd = args.cmd or "amixer"
alsabar.channel = args.channel or "Master"
alsabar.togglechannel = args.togglechannel
alsabar.colors = args.colors or alsabar.colors
alsabar.followtag = args.followtag or false
alsabar._notify = args.notify or "on"
@ -54,6 +55,11 @@ local function worker(args)
alsabar.notification_preset.font = "Monospace 11"
end
if alsabar.togglechannel then
alsabar.cmd = { awful.util.shell, "-c", string.format("%s get %s; %s get %s",
alsabar.cmd, alsabar.channel, alsabar.cmd, alsabar.togglechannel) }
end
alsabar.bar = wibox.widget {
forced_height = height,
forced_width = width,

2
wiki

@ -1 +1 @@
Subproject commit 85fa41e74a7ed2923f6e289273e436ff187c6fdc
Subproject commit 66836bbf1ffc0dd3bd3aef4799fff78ded9df4ec