File tree 2 files changed +37
-2
lines changed
crates/tauri-cli/src/info
2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " tauri-cli " : " patch:feat"
3
+ " @tauri-apps/cli " : " patch:feat"
4
+ ---
5
+
6
+ Include Linux destkop environment and session type in ` tauri info ` command.
7
+
Original file line number Diff line number Diff line change @@ -175,17 +175,45 @@ fn is_xcode_command_line_tools_installed() -> bool {
175
175
. map ( |o| o. status . success ( ) )
176
176
. unwrap_or ( false )
177
177
}
178
+ fn de_and_session ( ) -> String {
179
+ #[ cfg( any(
180
+ target_os = "linux" ,
181
+ target_os = "dragonfly" ,
182
+ target_os = "freebsd" ,
183
+ target_os = "openbsd" ,
184
+ target_os = "netbsd"
185
+ ) ) ]
186
+ return {
187
+ let de = std:: env:: var ( "DESKTOP_SESSION" ) ;
188
+ let session = std:: env:: var ( "XDG_SESSION_TYPE" ) ;
189
+ format ! (
190
+ " ({} on {})" ,
191
+ de. as_deref( ) . unwrap_or( "Unknown DE" ) ,
192
+ session. as_deref( ) . unwrap_or( "Unknown Session" )
193
+ )
194
+ } ;
195
+
196
+ #[ cfg( not( any(
197
+ target_os = "linux" ,
198
+ target_os = "dragonfly" ,
199
+ target_os = "freebsd" ,
200
+ target_os = "openbsd" ,
201
+ target_os = "netbsd"
202
+ ) ) ) ]
203
+ String :: new ( )
204
+ }
178
205
179
206
pub fn items ( ) -> Vec < SectionItem > {
180
207
vec ! [
181
208
SectionItem :: new( ) . action( || {
182
209
let os_info = os_info:: get( ) ;
183
210
format!(
184
- "OS: {} {} {} ({:?})" ,
211
+ "OS: {} {} {} ({:?}){} " ,
185
212
os_info. os_type( ) ,
186
213
os_info. version( ) ,
187
214
os_info. architecture( ) . unwrap_or( "Unknown Architecture" ) ,
188
- os_info. bitness( )
215
+ os_info. bitness( ) ,
216
+ de_and_session( ) ,
189
217
) . into( )
190
218
} ) ,
191
219
#[ cfg( windows) ]
You can’t perform that action at this time.
0 commit comments