You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.9 KiB
50 lines
1.9 KiB
-- This file is part of Reno desktop.
|
|
--
|
|
-- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
--
|
|
-- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
|
|
-- Compositor manager with inhibitor
|
|
local awful = require("awful")
|
|
-- Configuration variables
|
|
local cfg = config.compositor or {}
|
|
local compositor_enabled = false
|
|
local inhibitors = {}
|
|
local compositor_pid = nil
|
|
local function count(t)
|
|
local c = 0
|
|
for _,_ in pairs(t) do
|
|
c = c + 1
|
|
end
|
|
return c
|
|
end
|
|
if cfg.exec then
|
|
compositor_pid = awful.spawn(cfg.exec)
|
|
compositor_enabled = true
|
|
client.connect_signal("manage",function(c)
|
|
if c.inhibit_compositor then
|
|
inhibitors[c] = true
|
|
if compositor_enabled then
|
|
awful.spawn("kill "..tostring(compositor_pid))
|
|
compositor_enabled = false
|
|
end
|
|
end
|
|
end)
|
|
client.connect_signal("unmanage",function(c)
|
|
if c.inhibit_compositor then
|
|
inhibitors[c] = nil
|
|
if count(inhibitors) == 0 then
|
|
if compositor_enabled == false then
|
|
compositor_pid = awful.spawn(cfg.exec)
|
|
compositor_enabled = true
|
|
end
|
|
end
|
|
end
|
|
end)
|
|
awesome.connect_signal("exit",function()
|
|
if compositor_enabled and compositor_pid then
|
|
awful.spawn("kill "..tostring(compositor_pid))
|
|
end
|
|
end)
|
|
end
|