diff --git a/examples/context-menu/Cargo.toml b/examples/context-menu/Cargo.toml index 88a491e0681..133c642e7a1 100644 --- a/examples/context-menu/Cargo.toml +++ b/examples/context-menu/Cargo.toml @@ -11,4 +11,4 @@ tracing-log = "0.2.0" [dependencies.libcosmic] path = "../../" default-features = false -features = ["debug", "winit", "tokio", "xdg-portal"] +features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"] diff --git a/examples/context-menu/src/main.rs b/examples/context-menu/src/main.rs index 9f809dbef08..5ade4966926 100644 --- a/examples/context-menu/src/main.rs +++ b/examples/context-menu/src/main.rs @@ -74,7 +74,11 @@ impl cosmic::Application for App { }; app.set_header_title("COSMIC Context Menu Demo".into()); - let command = app.set_window_title("COSMIC Context Menu Demo".into()); + let command = if let Some(win_id) = app.core.main_window_id() { + app.set_window_title("COSMIC Context Menu Demo".into(), win_id) + } else { + Task::none() + }; (app, command) } @@ -108,18 +112,19 @@ impl App { Some(menu::items( &HashMap::new(), vec![ - menu::Item::Button("New window", ContextMenuAction::WindowNew), + menu::Item::Button("New window", None, ContextMenuAction::WindowNew), menu::Item::Divider, menu::Item::Folder( "View", vec![menu::Item::CheckBox( "Hide content", + None, self.hide_content, ContextMenuAction::ToggleHideContent, )], ), menu::Item::Divider, - menu::Item::Button("Quit", ContextMenuAction::WindowClose), + menu::Item::Button("Quit", None, ContextMenuAction::WindowClose), ], )) } diff --git a/examples/menu/Cargo.toml b/examples/menu/Cargo.toml index 44ece16e40c..4348ca0b7a3 100644 --- a/examples/menu/Cargo.toml +++ b/examples/menu/Cargo.toml @@ -11,4 +11,4 @@ tracing-log = "0.2.0" [dependencies.libcosmic] path = "../../" default-features = false -features = ["debug", "winit", "tokio", "xdg-portal"] +features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"] diff --git a/examples/nav-context/Cargo.toml b/examples/nav-context/Cargo.toml index 5ddad7fcf73..d0f3bce525e 100644 --- a/examples/nav-context/Cargo.toml +++ b/examples/nav-context/Cargo.toml @@ -11,4 +11,4 @@ tracing-log = "0.2.0" [dependencies.libcosmic] path = "../../" default-features = false -features = ["debug", "winit", "tokio", "xdg-portal"] +features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"] diff --git a/examples/nav-context/src/main.rs b/examples/nav-context/src/main.rs index 0786354249f..2285292a742 100644 --- a/examples/nav-context/src/main.rs +++ b/examples/nav-context/src/main.rs @@ -135,9 +135,9 @@ impl cosmic::Application for App { Some(menu::items( &HashMap::new(), vec![ - menu::Item::Button("Move Up", NavMenuAction::MoveUp(id)), - menu::Item::Button("Move Down", NavMenuAction::MoveDown(id)), - menu::Item::Button("Delete", NavMenuAction::Delete(id)), + menu::Item::Button("Move Up", None, NavMenuAction::MoveUp(id)), + menu::Item::Button("Move Down", None, NavMenuAction::MoveDown(id)), + menu::Item::Button("Delete", None, NavMenuAction::Delete(id)), ], )) } @@ -204,6 +204,10 @@ where let header_title = self.active_page_title().to_owned(); let window_title = format!("{header_title} — COSMIC AppDemo"); self.set_header_title(header_title); - self.set_window_title(window_title) + if let Some(win_id) = self.core.main_window_id() { + self.set_window_title(window_title, win_id) + } else { + Task::none() + } } }