From b25d0b5ff7191ee4f92a75d3a090e82c7de17fc7 Mon Sep 17 00:00:00 2001 From: Shehriyar Qureshi Date: Tue, 4 Mar 2025 14:50:54 +0500 Subject: [PATCH] fix(app): close selected preview on single click set context_page to preview with Some(entity) instead of None when "Show details" is selected. Preview of None entity would fail first equality check in Message::ToggleContextPage as `Preview(None, ..) != Preview(Some, ..)` . This fixes the two clicks needed to close Preview of Selected as first click would update self.context_page from Preview(None,..) to Preview(Some,..) and next click would pass equality and close Preview. --- src/app.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index c99aed4..d37e721 100644 --- a/src/app.rs +++ b/src/app.rs @@ -2704,7 +2704,7 @@ impl Application for App { match self.mode { Mode::App => { let show_details = !self.config.show_details; - self.context_page = ContextPage::Preview(None, PreviewKind::Selected); + self.context_page = ContextPage::Preview(entity_opt, PreviewKind::Selected); self.core.window.show_context = show_details; return cosmic::task::message(Message::SetShowDetails(show_details)); }