@@ -381,6 +381,30 @@ impl page::Page<crate::pages::Message> for Page {
381381 handle. abort ( ) ;
382382 }
383383
384+ // Dismiss display identifiers when leaving the page
385+ tokio:: spawn ( async {
386+ match tokio:: process:: Command :: new ( "cosmic-osd" )
387+ . arg ( "dismiss-display-identifiers" )
388+ . output ( )
389+ . await
390+ {
391+ Ok ( output) => {
392+ if !output. status . success ( ) {
393+ tracing:: error!(
394+ "cosmic-osd dismiss-display-identifiers failed: {}" ,
395+ String :: from_utf8_lossy( & output. stderr)
396+ ) ;
397+ }
398+ }
399+ Err ( why) => {
400+ tracing:: error!(
401+ why = why. to_string( ) ,
402+ "failed to execute cosmic-osd dismiss-display-identifiers"
403+ ) ;
404+ }
405+ }
406+ } ) ;
407+
384408 Task :: none ( )
385409 }
386410
@@ -644,6 +668,38 @@ impl Page {
644668 match Arc :: into_inner ( randr) {
645669 Some ( Ok ( outputs) ) => {
646670 self . update_displays ( outputs) ;
671+
672+ // Show display identifiers if there are 2+ enabled displays
673+ let enabled_count =
674+ self . list . outputs . values ( ) . filter ( |o| o. enabled ) . count ( ) ;
675+
676+ if enabled_count >= 2 {
677+ return Task :: perform (
678+ async {
679+ match tokio:: process:: Command :: new ( "cosmic-osd" )
680+ . arg ( "identify-displays" )
681+ . output ( )
682+ . await
683+ {
684+ Ok ( output) => {
685+ if !output. status . success ( ) {
686+ tracing:: error!(
687+ "cosmic-osd identify-displays failed: {}" ,
688+ String :: from_utf8_lossy( & output. stderr)
689+ ) ;
690+ }
691+ }
692+ Err ( why) => {
693+ tracing:: error!(
694+ why = why. to_string( ) ,
695+ "failed to execute cosmic-osd identify-displays"
696+ ) ;
697+ }
698+ }
699+ } ,
700+ |_| app:: Message :: None ,
701+ ) ;
702+ }
647703 }
648704
649705 Some ( Err ( why) ) => {
@@ -1207,35 +1263,17 @@ pub fn display_arrangement() -> Section<crate::pages::Message> {
12071263 . padding ( [ space_xxs, space_m] ) ,
12081264 )
12091265 . push ( {
1210- use cosmic:: iced:: widget:: stack;
1211- use cosmic:: iced_core:: Padding ;
1212-
1213- stack ! [
1214- // Bottom layer: arrangement scrollable
1215- Arrangement :: new( & page. list, & page. display_tabs)
1216- . on_select( |id| pages:: Message :: Displays ( Message :: Display ( id) ) )
1217- . on_pan( |pan| pages:: Message :: Displays ( Message :: Pan ( pan) ) )
1218- . on_placement( |id, x, y| {
1219- pages:: Message :: Displays ( Message :: Position ( id, x, y) )
1220- } )
1221- . apply( widget:: scrollable:: horizontal)
1222- . id( page. display_arrangement_scrollable. clone( ) )
1223- . width( Length :: Shrink )
1224- . apply( container)
1225- . center_x( Length :: Fill )
1226- . width( Length :: Fill )
1227- . align_y( cosmic:: iced_core:: alignment:: Vertical :: Top ) ,
1228- // Top layer: identify button positioned at bottom right
1229- widget:: button:: standard( fl!( "display" , "identify" ) )
1230- . on_press( pages:: Message :: Displays ( Message :: IdentifyDisplays ) )
1231- . apply( container)
1232- . width( Length :: Fill )
1233- . height( Length :: Fill )
1234- . padding( Padding :: from( [ 0 , space_m, space_m, 0 ] ) )
1235- . align_x( cosmic:: iced_core:: alignment:: Horizontal :: Right )
1236- . align_y( cosmic:: iced_core:: alignment:: Vertical :: Bottom )
1237- ]
1238- . width ( Length :: Fill )
1266+ Arrangement :: new ( & page. list , & page. display_tabs )
1267+ . on_select ( |id| pages:: Message :: Displays ( Message :: Display ( id) ) )
1268+ . on_pan ( |pan| pages:: Message :: Displays ( Message :: Pan ( pan) ) )
1269+ . on_placement ( |id, x, y| {
1270+ pages:: Message :: Displays ( Message :: Position ( id, x, y) )
1271+ } )
1272+ . apply ( widget:: scrollable:: horizontal)
1273+ . id ( page. display_arrangement_scrollable . clone ( ) )
1274+ . width ( Length :: Shrink )
1275+ . apply ( container)
1276+ . center_x ( Length :: Fill )
12391277 } )
12401278 . apply ( container)
12411279 . class ( cosmic:: theme:: Container :: List )
0 commit comments