add a toggle_dpms plugin

This commit is contained in:
fdev31 2023-04-29 20:51:18 +02:00
parent 8179aff7b2
commit 6d0e86a886
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,13 @@
from .interface import Plugin
from ..ipc import hyprctlJSON, hyprctl
class Extension(Plugin):
async def run_toggle_dpms(self):
monitors = await hyprctlJSON("monitors")
poweredOff = any(m["dpmsStatus"] for m in monitors)
if not poweredOff:
await hyprctl("dpms on")
else:
await hyprctl("dpms off")