awesomewm/wrapper/sound.lua

23 lines
469 B
Lua
Raw Normal View History

2021-08-01 07:24:26 -07:00
local sound = {}
sound.counter = 0
sound.play = function(sound_key)
if (beautiful.sounds[sound_key] == nil) then
naughty.notify({
title = "Sound play error:",
text = "There is no sound with key " .. sound_key
})
else
if (sound.counter > 5) then
return
end
sound.counter = sound.counter + 1
awful.spawn.easy_async("play -q \"" .. beautiful.sounds[sound_key] .. "\"", function()
sound.counter = sound.counter - 1
end)
end
end
return sound