pub fn for_each_output(for_each: impl FnMut(&OutputHandle) + Send + 'static)
Expand description
Runs a closure on all current and future outputs.
When called, this will do two things:
- Immediately run
for_each
with all currently connected outputs. - Call
for_each
with any newly connected outputs.
Note that for_each
will not run with outputs that have been unplugged and replugged.
This is to prevent duplicate setup. Instead, the compositor keeps track of any tags and
state the output had when unplugged and restores them on replug. This may change in the future.
ยงExamples
// Add tags 1-3 to all outputs and set tag "1" to active
output::for_each_output(|op| {
let mut tags = tag::add(op, ["1", "2", "3"]);
tags.next().unwrap().set_active(true);
});