-
-
Notifications
You must be signed in to change notification settings - Fork 631
Feat/per output power control #3192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements per-output power control functionality by adding support for the wlr-output-power-management-unstable-v1 Wayland protocol. This allows clients like wlopm to control power states of individual outputs.
Key changes:
- Added new protocol implementation for wlr-output-power-management-v1
- Integrated per-output power state tracking into the compositor
- Modified rendering logic to skip outputs that are powered off
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/protocols/output_power_management.rs | New protocol implementation handling power state management per output |
| src/protocols/mod.rs | Added output_power_management module export |
| src/niri.rs | Added power state tracking, monitor activation logic, and rendering checks for powered-off outputs |
| src/handlers/mod.rs | Implemented OutputPowerManagementHandler trait and delegation |
| src/backend/tty.rs | TTY backend support for clearing compositor when output is powered off |
| src/backend/mod.rs | Backend abstraction layer for set_output_power method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b4ce3d6 to
a17b357
Compare
This protocol allows external programs (e.g. wlopm) to control and query the output power state (on/off). In the current implementation, when the client sends a `set_mode` request, the handler calls `activate_monitors()` or `deactivate_monitors()` to set that state for all monitors. This is probably simpler than adding full support for per-output power management, and is good enough for the most common use cases like idle screensavers. The `output_power.mode` event is now emitted by `activate_monitors()` and `deactivate_monitors()` when the state changes. A bit of a rewrite was needed because the tty backend tries to activate monitors on resume, but previously it wasn't calling `activate_monitors()` because it is unable to provide a reference to the `Backend` that wraps it. I worked around this by adding a second method that does not take a backend parameter, instead assuming that the backend will take care of calling itself.
- removed redundant call to niri.idle_notifier_state.notify_activity(), it's already called in niri.notify_activity() - changed destroyed handler to remove only the disconnected client instead of all clients.
Adds per-output power control on top of PR YaLTeR#3077's global implementation: - Add power_mode: Mode field to OutputState (defaults to On) - Add set_output_power() method in TtyBackend following VRR pattern - Block redraw when per-output power_mode is Off - Update protocol handler to use per-output state instead of global monitors_active - Global monitors_active still takes precedence (AND logic) - activate_monitors() restores individual output power states Fixes YaLTeR#108 with true per-output DPMS support.
056c2bb to
7061cda
Compare
Built on-top #3077. Rebases cleanly.
Tested it with wlopm and it works.
But I don't actually have multi-monitor setup so I can't test that part. Can some one who does please take a look at this?
Definitely needs more tests too.