23 lines
469 B
Lua
23 lines
469 B
Lua
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
|