File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
crates/tauri-cli/src/info Expand file tree Collapse file tree 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 {
175175 . map ( |o| o. status . success ( ) )
176176 . unwrap_or ( false )
177177}
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+ }
178205
179206pub fn items ( ) -> Vec < SectionItem > {
180207 vec ! [
181208 SectionItem :: new( ) . action( || {
182209 let os_info = os_info:: get( ) ;
183210 format!(
184- "OS: {} {} {} ({:?})" ,
211+ "OS: {} {} {} ({:?}){} " ,
185212 os_info. os_type( ) ,
186213 os_info. version( ) ,
187214 os_info. architecture( ) . unwrap_or( "Unknown Architecture" ) ,
188- os_info. bitness( )
215+ os_info. bitness( ) ,
216+ de_and_session( ) ,
189217 ) . into( )
190218 } ) ,
191219 #[ cfg( windows) ]
You can’t perform that action at this time.
0 commit comments