2024-02-18 20:26:15 -08:00
|
|
|
local awful = require "awful"
|
|
|
|
local gears = require "gears"
|
|
|
|
local wibox = require "wibox"
|
2024-02-18 14:31:14 -08:00
|
|
|
|
2024-02-18 20:26:15 -08:00
|
|
|
local vol_sc = 'pamixer --get-volume'
|
|
|
|
local mute_sc = 'pamixer --get-mute'
|
2024-02-18 14:31:14 -08:00
|
|
|
|
|
|
|
local function get_vol()
|
|
|
|
awful.spawn.easy_async_with_shell(vol_sc, function(vol)
|
|
|
|
awful.spawn.easy_async_with_shell(mute_sc, function(mute)
|
2024-02-18 20:26:15 -08:00
|
|
|
if mute:match("false") then
|
2024-02-18 14:31:14 -08:00
|
|
|
muted = false
|
|
|
|
else
|
|
|
|
muted = true
|
|
|
|
end
|
|
|
|
|
|
|
|
awesome.emit_signal("signal::volume", vol, muted)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end
|
2024-02-18 20:26:15 -08:00
|
|
|
awesome.connect_signal("widget::update_vol", function() -- Needs to be Updated if muted! For Pulseaudio Widget
|
|
|
|
get_vol()
|
2024-02-18 14:31:14 -08:00
|
|
|
end)
|
2024-02-18 20:26:15 -08:00
|
|
|
--gears.timer {
|
|
|
|
-- timeout = 10,
|
|
|
|
-- call_now = true,
|
|
|
|
-- autostart = true,
|
|
|
|
-- callback = function()
|
|
|
|
-- get_vol()
|
|
|
|
-- end
|
|
|
|
--}
|
2024-02-18 14:31:14 -08:00
|
|
|
get_vol()
|
2024-02-18 20:26:15 -08:00
|
|
|
|
|
|
|
|