Skip to content

Commit 7333556

Browse files
QuantenToastmmstick
authored andcommitted
fix(displays): disable display when disabling mirroring on a projected display
1 parent 6ebc220 commit 7333556

File tree

1 file changed

+18
-1
lines changed
  • cosmic-settings/src/pages/display

1 file changed

+18
-1
lines changed

cosmic-settings/src/pages/display/mod.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use cosmic_randr_shell::{
1616
AdaptiveSyncAvailability, AdaptiveSyncState, List, Output, OutputKey, Transform,
1717
};
1818
use cosmic_settings_page::{self as page, Section, section};
19+
use indexmap::Equivalent;
1920
use slab::Slab;
2021
use slotmap::{Key, SecondaryMap, SlotMap};
2122
use std::sync::atomic::{AtomicBool, Ordering};
@@ -546,7 +547,23 @@ impl Page {
546547
Message::DisplayToggle(enable) => return self.toggle_display(enable),
547548

548549
Message::Mirroring(mirroring) => match mirroring {
549-
Mirroring::Disable => return self.toggle_display(true),
550+
Mirroring::Disable => {
551+
for k in self.mirror_map.keys() {
552+
if k.equivalent(&self.active_display) {
553+
return self.toggle_display(true);
554+
}
555+
556+
if let Some(v) = self.mirror_map.get(k) && v.equivalent(&self.active_display) {
557+
if let Some(output) = self.list.outputs.get(k) {
558+
return self.exec_randr(output, Randr::Toggle(true));
559+
} else {
560+
return Task::none();
561+
}
562+
}
563+
}
564+
565+
return Task::none();
566+
},
550567

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

0 commit comments

Comments
 (0)