Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion cosmic-settings/src/pages/display/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use cosmic_randr_shell::{
AdaptiveSyncAvailability, AdaptiveSyncState, List, Output, OutputKey, Transform,
};
use cosmic_settings_page::{self as page, Section, section};
use indexmap::Equivalent;
use slab::Slab;
use slotmap::{Key, SecondaryMap, SlotMap};
use std::sync::atomic::{AtomicBool, Ordering};
Expand Down Expand Up @@ -546,7 +547,23 @@ impl Page {
Message::DisplayToggle(enable) => return self.toggle_display(enable),

Message::Mirroring(mirroring) => match mirroring {
Mirroring::Disable => return self.toggle_display(true),
Mirroring::Disable => {
for k in self.mirror_map.keys() {
if k.equivalent(&self.active_display) {
return self.toggle_display(true);
}

if let Some(v) = self.mirror_map.get(k) && v.equivalent(&self.active_display) {
if let Some(output) = self.list.outputs.get(k) {
return self.exec_randr(output, Randr::Toggle(true));
} else {
return Task::none();
}
}
}

return Task::none();
},

Mirroring::Mirror(from_display) => {
let Some(output) = self.list.outputs.get(self.active_display) else {
Expand Down