-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linux) add
with_temp_icon_dir
builder extension (#452)
* linux: Defer writing files to the `SystemTrayBuilder::build` call * linux: Add an argument to `temp_icon_path` for a custom directory * linux: Add `temp_icon_dir` field to the `SystemTrayBuilder` * linux: Add `with_temp_icon_dir` builder method * linux: Use `with_temp_icon_dir` in `system_tray` example * Add changes file * Format with cargo fmt Rather than rust analyzer
- Loading branch information
Showing
5 changed files
with
82 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"tao": minor | ||
--- | ||
|
||
On Linux, adds `SystemTrayBuilderExtLinux::with_temp_icon_dir` which sets a custom temp icon dir to store generated icon files. | ||
This may be useful when the application requires icons to be stored in a specific location, such as when running in a Flatpak sandbox. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#![cfg(target_os = "linux")] | ||
|
||
#[cfg(feature = "tray")] | ||
use crate::system_tray::SystemTrayBuilder; | ||
#[cfg(feature = "tray")] | ||
use std::path::Path; | ||
|
||
#[cfg(feature = "tray")] | ||
pub trait SystemTrayBuilderExtLinux { | ||
/// Sets a custom temp icon dir to store generated icon files. | ||
fn with_temp_icon_dir<P: AsRef<Path>>(self, p: P) -> Self; | ||
} | ||
|
||
#[cfg(feature = "tray")] | ||
impl SystemTrayBuilderExtLinux for SystemTrayBuilder { | ||
fn with_temp_icon_dir<P: AsRef<Path>>(mut self, p: P) -> Self { | ||
self.0.temp_icon_dir = Some(p.as_ref().to_path_buf()); | ||
self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters