1
+ #[ cfg( not( windows) ) ]
1
2
pub use freedesktop_desktop_entry:: DesktopEntry ;
3
+ #[ cfg( not( windows) ) ]
2
4
pub use mime:: Mime ;
3
- use std:: {
4
- borrow:: Cow ,
5
- ffi:: OsStr ,
6
- path:: { Path , PathBuf } ,
7
- } ;
5
+ use std:: path:: { Path , PathBuf } ;
6
+ #[ cfg( not( windows) ) ]
7
+ use std:: { borrow:: Cow , ffi:: OsStr } ;
8
8
9
9
#[ derive( Debug , Clone , PartialEq , Eq ) ]
10
10
pub enum IconSource {
@@ -42,12 +42,14 @@ impl Default for IconSource {
42
42
}
43
43
}
44
44
45
+ #[ cfg( not( windows) ) ]
45
46
#[ derive( Debug , Clone , PartialEq ) ]
46
47
pub struct DesktopAction {
47
48
pub name : String ,
48
49
pub exec : String ,
49
50
}
50
51
52
+ #[ cfg( not( windows) ) ]
51
53
#[ derive( Debug , Clone , PartialEq , Default ) ]
52
54
pub struct DesktopEntryData {
53
55
pub id : String ,
@@ -62,13 +64,15 @@ pub struct DesktopEntryData {
62
64
pub prefers_dgpu : bool ,
63
65
}
64
66
67
+ #[ cfg( not( windows) ) ]
65
68
pub fn load_applications < ' a > (
66
69
locale : impl Into < Option < & ' a str > > ,
67
70
include_no_display : bool ,
68
71
) -> Vec < DesktopEntryData > {
69
72
load_applications_filtered ( locale, |de| include_no_display || !de. no_display ( ) )
70
73
}
71
74
75
+ #[ cfg( not( windows) ) ]
72
76
pub fn app_id_or_fallback_matches ( app_id : & str , entry : & DesktopEntryData ) -> bool {
73
77
let lowercase_wm_class = match entry. wm_class . as_ref ( ) {
74
78
Some ( s) => Some ( s. to_lowercase ( ) ) ,
@@ -80,6 +84,7 @@ pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> boo
80
84
|| app_id. to_lowercase ( ) == entry. name . to_lowercase ( )
81
85
}
82
86
87
+ #[ cfg( not( windows) ) ]
83
88
pub fn load_applications_for_app_ids < ' a , ' b > (
84
89
locale : impl Into < Option < & ' a str > > ,
85
90
app_ids : impl Iterator < Item = & ' b str > ,
@@ -123,6 +128,7 @@ pub fn load_applications_for_app_ids<'a, 'b>(
123
128
applications
124
129
}
125
130
131
+ #[ cfg( not( windows) ) ]
126
132
pub fn load_applications_filtered < ' a , F : FnMut ( & DesktopEntry ) -> bool > (
127
133
locale : impl Into < Option < & ' a str > > ,
128
134
mut filter : F ,
@@ -148,6 +154,7 @@ pub fn load_applications_filtered<'a, F: FnMut(&DesktopEntry) -> bool>(
148
154
. collect ( )
149
155
}
150
156
157
+ #[ cfg( not( windows) ) ]
151
158
pub fn load_desktop_file < ' a > (
152
159
locale : impl Into < Option < & ' a str > > ,
153
160
path : impl AsRef < Path > ,
@@ -160,6 +167,7 @@ pub fn load_desktop_file<'a>(
160
167
} )
161
168
}
162
169
170
+ #[ cfg( not( windows) ) ]
163
171
impl DesktopEntryData {
164
172
fn from_desktop_entry < ' a > (
165
173
locale : impl Into < Option < & ' a str > > ,
@@ -229,6 +237,7 @@ impl DesktopEntryData {
229
237
}
230
238
}
231
239
240
+ #[ cfg( not( windows) ) ]
232
241
pub async fn spawn_desktop_exec < S , I , K , V > ( exec : S , env_vars : I , app_id : Option < & str > )
233
242
where
234
243
S : AsRef < str > ,
@@ -293,6 +302,7 @@ where
293
302
}
294
303
}
295
304
305
+ #[ cfg( not( windows) ) ]
296
306
#[ cfg( feature = "desktop-systemd-scope" ) ]
297
307
#[ zbus:: proxy(
298
308
interface = "org.freedesktop.systemd1.Manager" ,
0 commit comments