@@ -218,11 +218,6 @@ pub struct TrayIconBuilder<R: Runtime> {
218
218
219
219
impl < R : Runtime > TrayIconBuilder < R > {
220
220
/// Creates a new tray icon builder.
221
- ///
222
- /// ## Platform-specific:
223
- ///
224
- /// - **Linux:** Sometimes the icon won't be visible unless a menu is set.
225
- /// Setting an empty [`Menu`](crate::menu::Menu) is enough.
226
221
pub fn new ( ) -> Self {
227
222
Self {
228
223
inner : tray_icon:: TrayIconBuilder :: new ( ) ,
@@ -232,11 +227,6 @@ impl<R: Runtime> TrayIconBuilder<R> {
232
227
}
233
228
234
229
/// Creates a new tray icon builder with the specified id.
235
- ///
236
- /// ## Platform-specific:
237
- ///
238
- /// - **Linux:** Sometimes the icon won't be visible unless a menu is set.
239
- /// Setting an empty [`Menu`](crate::menu::Menu) is enough.
240
230
pub fn with_id < I : Into < TrayIconId > > ( id : I ) -> Self {
241
231
let mut builder = Self :: new ( ) ;
242
232
builder. inner = builder. inner . with_id ( id) ;
@@ -259,6 +249,7 @@ impl<R: Runtime> TrayIconBuilder<R> {
259
249
///
260
250
/// - **Linux:** Sometimes the icon won't be visible unless a menu is set.
261
251
/// Setting an empty [`Menu`](crate::menu::Menu) is enough.
252
+ /// Works with feature `linux-ksni`.
262
253
pub fn icon ( mut self , icon : Image < ' _ > ) -> Self {
263
254
let icon = icon. try_into ( ) . ok ( ) ;
264
255
if let Some ( icon) = icon {
@@ -271,7 +262,7 @@ impl<R: Runtime> TrayIconBuilder<R> {
271
262
///
272
263
/// ## Platform-specific:
273
264
///
274
- /// - **Linux:** Unsupported.
265
+ /// - **Linux:** Unsupported. Works with feature `linux-ksni`.
275
266
pub fn tooltip < S : AsRef < str > > ( mut self , s : S ) -> Self {
276
267
self . inner = self . inner . with_tooltip ( s) ;
277
268
self
@@ -286,16 +277,20 @@ impl<R: Runtime> TrayIconBuilder<R> {
286
277
/// updated information. In general, it shouldn't be shown unless a
287
278
/// user requests it as it can take up a significant amount of space
288
279
/// on the user's panel. This may not be shown in all visualizations.
280
+ /// Works with feature `linux-ksni`.
289
281
/// - **Windows:** Unsupported.
290
282
pub fn title < S : AsRef < str > > ( mut self , title : S ) -> Self {
291
283
self . inner = self . inner . with_title ( title) ;
292
284
self
293
285
}
294
286
295
287
/// Set tray icon temp dir path. **Linux only**.
288
+ ///
289
+ /// Not availabe with feature `linux-ksni`.
296
290
///
297
291
/// On Linux, we need to write the icon to the disk and usually it will
298
292
/// be `$XDG_RUNTIME_DIR/tray-icon` or `$TEMP/tray-icon`.
293
+ #[ cfg( not( feature = "linux-ksni" ) ) ]
299
294
pub fn temp_dir_path < P : AsRef < Path > > ( mut self , s : P ) -> Self {
300
295
self . inner = self . inner . with_temp_dir_path ( s) ;
301
296
self
@@ -509,7 +504,7 @@ impl<R: Runtime> TrayIcon<R> {
509
504
///
510
505
/// ## Platform-specific:
511
506
///
512
- /// - **Linux**: once a menu is set it cannot be removed so `None` has no effect
507
+ /// - **Linux**: Once a menu is set it cannot be removed so `None` has no effect. Works with feature `linux-ksni`.
513
508
pub fn set_menu < M : ContextMenu + ' static > ( & self , menu : Option < M > ) -> crate :: Result < ( ) > {
514
509
run_item_main_thread ! ( self , |self_: Self | {
515
510
self_. inner. set_menu( menu. map( |m| m. inner_context_owned( ) ) )
@@ -520,7 +515,7 @@ impl<R: Runtime> TrayIcon<R> {
520
515
///
521
516
/// ## Platform-specific:
522
517
///
523
- /// - **Linux:** Unsupported
518
+ /// - **Linux:** Unsupported. Works with feature `linux-ksni`.
524
519
pub fn set_tooltip < S : AsRef < str > > ( & self , tooltip : Option < S > ) -> crate :: Result < ( ) > {
525
520
let s = tooltip. map ( |s| s. as_ref ( ) . to_string ( ) ) ;
526
521
run_item_main_thread ! ( self , |self_: Self | self_. inner. set_tooltip( s) ) ?. map_err ( Into :: into)
@@ -535,6 +530,7 @@ impl<R: Runtime> TrayIcon<R> {
535
530
/// updated information. In general, it shouldn't be shown unless a
536
531
/// user requests it as it can take up a significant amount of space
537
532
/// on the user's panel. This may not be shown in all visualizations.
533
+ /// Works with feature `linux-ksni`.
538
534
/// - **Windows:** Unsupported
539
535
pub fn set_title < S : AsRef < str > > ( & self , title : Option < S > ) -> crate :: Result < ( ) > {
540
536
let s = title. map ( |s| s. as_ref ( ) . to_string ( ) ) ;
@@ -547,9 +543,12 @@ impl<R: Runtime> TrayIcon<R> {
547
543
}
548
544
549
545
/// Sets the tray icon temp dir path. **Linux only**.
546
+ ///
547
+ /// Not availabe with feature `linux-ksni`.
550
548
///
551
549
/// On Linux, we need to write the icon to the disk and usually it will
552
550
/// be `$XDG_RUNTIME_DIR/tray-icon` or `$TEMP/tray-icon`.
551
+ #[ cfg( not( feature = "linux-ksni" ) ) ]
553
552
pub fn set_temp_dir_path < P : AsRef < Path > > ( & self , path : Option < P > ) -> crate :: Result < ( ) > {
554
553
#[ allow( unused) ]
555
554
let p = path. map ( |p| p. as_ref ( ) . to_path_buf ( ) ) ;
0 commit comments