X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/9bed174f669ab4dabc460f748e5325e37bc406a7..af39d38d11abfaefda1f22480ee8d1d3654620cb:/.config/awesome/rc.lua?ds=inline diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index e630208..18209c0 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -576,6 +576,27 @@ function hook_battery() end -- }}} +-- from https://blog.mister-muffin.de/2014/11/07/automatically-suspending-cpu-hungry-applications/ +client.add_signal("focus", function(c) + if c.class == "Iceweasel" or c.class == "chromium" or c.class == "Icedove" then + awful.util.spawn("kill -CONT " .. c.pid) + end +end) +client.add_signal("unfocus", function(c) + local capi = { timer = timer } + if c.class == "Iceweasel" or c.class == "chromium" or c.class == "Icedove" then + local timer_stop = capi.timer { timeout = 10 } + local send_sigstop = function () + timer_stop:stop() + if client.focus.pid ~= c.pid then + awful.util.spawn("kill -STOP " .. c.pid) + end + end + timer_stop:add_signal("timeout", send_sigstop) + timer_stop:start() + end +end) + -- {{{ Statusbar battery -- function get_acpibatt()