Compositor inhibiting
This commit is contained in:
parent
ac15d2ce70
commit
02a3db7ebd
19
desktop.conf
19
desktop.conf
|
@ -46,7 +46,24 @@ XF86AudioPlay = ":mpc.play"
|
||||||
XF86AudioPrev = ":mpc.prev"
|
XF86AudioPrev = ":mpc.prev"
|
||||||
XF86AudioNext = ":mpc.next"
|
XF86AudioNext = ":mpc.next"
|
||||||
|
|
||||||
|
|
||||||
# Custom keys
|
# Custom keys
|
||||||
Print = "flameshot gui"
|
Print = "flameshot gui"
|
||||||
Shift+Print = "flameshot launcher"
|
Shift+Print = "flameshot launcher"
|
||||||
|
|
||||||
|
# Power manager module
|
||||||
|
[powerman]
|
||||||
|
# Bad battery condition warning threshold
|
||||||
|
battery_quality_min = 33
|
||||||
|
# Low battery warning threshold
|
||||||
|
battery_capacity_min = 15
|
||||||
|
# Process to execute on low battery
|
||||||
|
on_low_battery = ""
|
||||||
|
# Process to execute on fully charged battery
|
||||||
|
on_charged_battery = ""
|
||||||
|
# Process to execute on critical battery condition
|
||||||
|
on_critical_condition = ""
|
||||||
|
|
||||||
|
# Simple compositor inhibiting
|
||||||
|
[compositor]
|
||||||
|
# Command to use to spawn compositor
|
||||||
|
exec = "picom"
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
-- 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
|
|
@ -6,6 +6,7 @@
|
||||||
--
|
--
|
||||||
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
|
-- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
|
||||||
-- Powerman X - second generation of the power management daemon
|
-- Powerman X - second generation of the power management daemon
|
||||||
|
local awful = require("awful")
|
||||||
local sysctl = require("syscontrol")
|
local sysctl = require("syscontrol")
|
||||||
local naughty = require("naughty")
|
local naughty = require("naughty")
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
|
@ -15,6 +16,9 @@ local state_tracking = {}
|
||||||
local cfg = config.powerman or {}
|
local cfg = config.powerman or {}
|
||||||
local quality_min = cfg.battery_quality_min or 33
|
local quality_min = cfg.battery_quality_min or 33
|
||||||
local capacity_min = cfg.battery_capacity_min or 15
|
local capacity_min = cfg.battery_capacity_min or 15
|
||||||
|
local on_low_battery = cfg.on_low_battery or ""
|
||||||
|
local on_charged_battery = cfg.on_charged_battery
|
||||||
|
local on_critical_condition = cfg.on_critical_condition
|
||||||
-- Main loop
|
-- Main loop
|
||||||
gears.timer({
|
gears.timer({
|
||||||
timeout = 2,
|
timeout = 2,
|
||||||
|
@ -31,6 +35,9 @@ gears.timer({
|
||||||
text = "Battery "..data.name.." has reached critically low condition, seek a suitable replacement"
|
text = "Battery "..data.name.." has reached critically low condition, seek a suitable replacement"
|
||||||
})
|
})
|
||||||
state_tracking[v].quality_notification = true
|
state_tracking[v].quality_notification = true
|
||||||
|
if on_critical_condition then
|
||||||
|
awful.spawn(on_critical_condition)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if (tonumber(data.capacity) <= capacity_min) and
|
if (tonumber(data.capacity) <= capacity_min) and
|
||||||
(not data.charging) and
|
(not data.charging) and
|
||||||
|
@ -40,6 +47,9 @@ gears.timer({
|
||||||
text = "Battery "..data.name.." capacity is at "..tostring(data.capacity).."%"
|
text = "Battery "..data.name.." capacity is at "..tostring(data.capacity).."%"
|
||||||
})
|
})
|
||||||
state_tracking[v].capacity_notification = true
|
state_tracking[v].capacity_notification = true
|
||||||
|
if on_low_battery then
|
||||||
|
awful.spawn(on_low_battery)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if (tonumber(data.capacity) > capacity_min) then
|
if (tonumber(data.capacity) > capacity_min) then
|
||||||
state_tracking[v].capacity_notification = false
|
state_tracking[v].capacity_notification = false
|
||||||
|
@ -51,6 +61,9 @@ gears.timer({
|
||||||
title = "Battery is completely charged",
|
title = "Battery is completely charged",
|
||||||
text = "Disconnect the charger from the power grid to avoid passive electricity usage."
|
text = "Disconnect the charger from the power grid to avoid passive electricity usage."
|
||||||
})
|
})
|
||||||
|
if on_charged_battery then
|
||||||
|
awful.spawn(on_charged_battery)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if (not data.charging) then
|
if (not data.charging) then
|
||||||
state_tracking[v].charged_notification = false
|
state_tracking[v].charged_notification = false
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
local awful = require("awful")
|
||||||
|
local gears = require("gears")
|
||||||
|
awful.rules.rules = gears.table.join(awful.rules.rules, {
|
||||||
|
{ rule_any = { class = {
|
||||||
|
"steam_app_548430",
|
||||||
|
"steam_app_%d*",
|
||||||
|
"love"
|
||||||
|
}},
|
||||||
|
properties = {inhibit_compositor = true},
|
||||||
|
},
|
||||||
|
})
|
3
rc.lua
3
rc.lua
|
@ -17,8 +17,9 @@ package.cpath = package.cpath
|
||||||
require("modules.collect_garbage")
|
require("modules.collect_garbage")
|
||||||
require("modules.global")
|
require("modules.global")
|
||||||
require("modules.powermanX")
|
require("modules.powermanX")
|
||||||
require("modules.errorlog")
|
|
||||||
require("modules.base")
|
require("modules.base")
|
||||||
|
require("modules.rules_stub")
|
||||||
|
require("modules.compositor")
|
||||||
require("modules.binds")
|
require("modules.binds")
|
||||||
require("modules.xdg_data")
|
require("modules.xdg_data")
|
||||||
require("modules.autostart")
|
require("modules.autostart")
|
||||||
|
|
Loading…
Reference in New Issue