Skip to content

Commit

Permalink
feat(tray): hide indicator on drop on Linux (#521)
Browse files Browse the repository at this point in the history
* feat(tray): hide indicator on drop on Linux
  • Loading branch information
lucasfernog committed Aug 4, 2022
1 parent aca4d3f commit 9c6a543
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/tray-linux-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": patch
---

Hide the app indicator when dropping `SystemTray` on Linux
1 change: 1 addition & 0 deletions src/platform_impl/linux/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl SystemTray {

impl Drop for SystemTray {
fn drop(&mut self) {
self.app_indicator.set_status(AppIndicatorStatus::Passive);
let _ = std::fs::remove_file(self.path.clone());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl SystemTrayBuilder {
///
/// **Linux:**
/// - Dropping the tray too early could lead to a default icon.
/// - Dropping the tray after the icon has been added to the system tray may not remove it.
/// - Dropping the tray hides it.
/// **Windows / macOS:** Dropping the tray will effectively remove the icon from the system tray.
pub struct SystemTray(pub SystemTrayPlatform);

Expand Down

0 comments on commit 9c6a543

Please sign in to comment.