Autosuspending Firefox in Awesome

Write your post here.

-- Firefox suspend timer.
local foxtimer 
client.connect_signal("unfocus", function(c) if c.class == "Firefox" then
                                        foxtimer = gears.timer { timeout = 30, single_shot = true, autostart = true, callback = function ()
                                                awful.util.spawn("kill -SIGSTOP " .. c.pid, false)
                                                naughty.notify({ text = "Suspending Firefox", timeout = 3 })
                                        end }
                                end end)
client.connect_signal("focus",   function(c) if c.class == "Firefox" then
                                        if foxtimer then foxtimer:stop() end
                                        awful.util.spawn("kill -SIGCONT " .. c.pid, false)
                                end end)