Skip to content

Conversation

@Atan-D-RP4
Copy link

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.

Copilot AI review requested due to automatic review settings January 3, 2026 18:42
Copy link

Copilot AI left a 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.

@Atan-D-RP4 Atan-D-RP4 force-pushed the feat/per-output-power-control branch from b4ce3d6 to a17b357 Compare January 5, 2026 16:31
agausmann and others added 5 commits January 8, 2026 09:17
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.
@Atan-D-RP4 Atan-D-RP4 force-pushed the feat/per-output-power-control branch from 056c2bb to 7061cda Compare January 8, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants