From e5b5be048c087e04bd504d4c13a48317d7a45915 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 12 Jul 2017 15:45:45 -0300 Subject: Refactor for 4.x compatibility --- config.dot/awesome.link/widgets/volume.lua | 34 ------------------------------ 1 file changed, 34 deletions(-) delete mode 100644 config.dot/awesome.link/widgets/volume.lua (limited to 'config.dot/awesome.link/widgets/volume.lua') diff --git a/config.dot/awesome.link/widgets/volume.lua b/config.dot/awesome.link/widgets/volume.lua deleted file mode 100644 index c183cb9..0000000 --- a/config.dot/awesome.link/widgets/volume.lua +++ /dev/null @@ -1,34 +0,0 @@ --- See http://awesome.naquadah.org/wiki/Volume_control_and_display -volume_widget = widget({ type = "textbox", name = "tb_volume", - align = "right" }) - -function update_volume(widget) - local fd = io.popen("amixer sget Master") - local status = fd:read("*all") - fd:close() - - local volume = tonumber(string.match(status, "(%d?%d?%d)%%")) / 100 - -- volume = string.format("% 3d", volume) - - status = string.match(status, "%[(o[^%]]*)%]") - - -- starting colour - local sr, sg, sb = 0x3F, 0x3F, 0x3F - -- ending colour - local er, eg, eb = 0xDC, 0xDC, 0xCC - - local ir = volume * (er - sr) + sr - local ig = volume * (eg - sg) + sg - local ib = volume * (eb - sb) + sb - interpol_colour = string.format("%.2x%.2x%.2x", ir, ig, ib) - if string.find(status, "on", 1, true) then - volume = " " - else - volume = " M " - end - widget.text = volume - end - -volumeTimer = timer({ timeout = 1 }) -volumeTimer:add_signal("timeout", function () update_volume(volume_widget) end) -volumeTimer:start() -- cgit v1.2.3