diff --git a/README.md b/README.md index eb1572f..e0cc627 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pyprland/plugins/toggle_dpms.py b/pyprland/plugins/toggle_dpms.py new file mode 100644 index 0000000..c774f96 --- /dev/null +++ b/pyprland/plugins/toggle_dpms.py @@ -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")