mirror of https://github.com/lcpz/lain.git
alsa{bar}: add togglechannel back
This commit is contained in:
parent
ff61857e15
commit
156515eb28
|
@ -8,6 +8,7 @@
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local helpers = require("lain.helpers")
|
local helpers = require("lain.helpers")
|
||||||
|
local shell = require("awful.util").shell
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local string = { match = string.match,
|
local string = { match = string.match,
|
||||||
format = string.format }
|
format = string.format }
|
||||||
|
@ -24,6 +25,13 @@ local function worker(args)
|
||||||
|
|
||||||
alsa.cmd = args.cmd or "amixer"
|
alsa.cmd = args.cmd or "amixer"
|
||||||
alsa.channel = args.channel or "Master"
|
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 = {}
|
alsa.last = {}
|
||||||
|
|
||||||
function alsa.update()
|
function alsa.update()
|
||||||
|
@ -39,6 +47,7 @@ local function worker(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
timer_id = string.format("alsa-%s-%s", alsa.cmd, alsa.channel)
|
timer_id = string.format("alsa-%s-%s", alsa.cmd, alsa.channel)
|
||||||
|
|
||||||
helpers.newtimer(timer_id, timeout, alsa.update)
|
helpers.newtimer(timer_id, timeout, alsa.update)
|
||||||
|
|
||||||
return alsa
|
return alsa
|
||||||
|
|
|
@ -44,6 +44,7 @@ local function worker(args)
|
||||||
|
|
||||||
alsabar.cmd = args.cmd or "amixer"
|
alsabar.cmd = args.cmd or "amixer"
|
||||||
alsabar.channel = args.channel or "Master"
|
alsabar.channel = args.channel or "Master"
|
||||||
|
alsabar.togglechannel = args.togglechannel
|
||||||
alsabar.colors = args.colors or alsabar.colors
|
alsabar.colors = args.colors or alsabar.colors
|
||||||
alsabar.followtag = args.followtag or false
|
alsabar.followtag = args.followtag or false
|
||||||
alsabar._notify = args.notify or "on"
|
alsabar._notify = args.notify or "on"
|
||||||
|
@ -54,6 +55,11 @@ local function worker(args)
|
||||||
alsabar.notification_preset.font = "Monospace 11"
|
alsabar.notification_preset.font = "Monospace 11"
|
||||||
end
|
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 {
|
alsabar.bar = wibox.widget {
|
||||||
forced_height = height,
|
forced_height = height,
|
||||||
forced_width = width,
|
forced_width = width,
|
||||||
|
|
2
wiki
2
wiki
|
@ -1 +1 @@
|
||||||
Subproject commit 85fa41e74a7ed2923f6e289273e436ff187c6fdc
|
Subproject commit 66836bbf1ffc0dd3bd3aef4799fff78ded9df4ec
|
Loading…
Reference in New Issue