awesomewm/core/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
2022-11-05 17:03:16 -07:00
if (sound.counter > 0) then
2021-08-01 07:24:26 -07:00
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