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

@ -29,6 +29,7 @@ A single config file `~/.config/hypr/pyprland.json` is used, using the following
- `monitors` allows relative placement of monitors depending on the model
- `workspaces_follow_focus` provides commands and handlers allowing a more flexible workspaces usage on multi-monitor setups. If you think the multi-screen behavior of hyprland is not usable or broken/unexpected, this is probably for you.
- `lost_windows` brings lost floating windows to the current workspace
- `toggle_dpms` toggles the DPMS status of every plugged monitor
## Installation
@ -84,6 +85,13 @@ Create a configuration file in `~/.config/hypr/pyprland.json` enabling a list of
# Configuring plugins
## `toggle_dpms` plugin
### Command
- `toggle_dpms`: if any screen is powered on, turn them all off, else turn them all on
## `lost_windows` plugin
### Command

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")