Signed-off-by: Rainer Bendig <hexathos@mailbox.org>
This commit is contained in:
2020-02-25 23:55:12 +01:00
parent 5ba5cf9f2b
commit 9b3266a32e
33 changed files with 1551 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
-- Alexander Tsepkov, 2015
--
-- Minimalistic Volume Widget that works with multiple output sources
-- dependency: FontAwesome
local wibox = require("wibox")
local naughty = require("naughty")
local last_id
local vol_muted
function mixercommand(command)
local fd = io.popen(os.getenv("HOME") .. "/.config/awesome/pa-vol.sh " .. command)
local status = fd:read("*all")
fd:close()
local pic = os.getenv("HOME") .. "/.config/awesome/widgets/volume/"
local value
if status == "Muted\n" then
pic = pic .. "audio-muted.png"
else
-- dividing by 26 is a little cheat to prevent overflow on 100%
value = math.floor(tonumber(string.sub(status:gsub("%s+$", ""), 0, -2)) / 26)
pic = pic .. "audio-" .. value .. ".png"
end
last_id = naughty.notify({
title = "Volume",
text = status,
replaces_id = last_id,
icon = pic,
}).id
end
function volumeup()
mixercommand("plus")
end
function volumedown()
mixercommand("minus")
end
function volumetoggle()
mixercommand("mute")
end
-- zenstate not applicable bescause there is no volume icon for this widget at all
-- this widget doesn't have an icon, I use volumeicon instead but I prefer the messages/control through this
-- widget instead
widget = {
up = volumeup,
down = volumedown,
toggle = volumetoggle,
}