mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
feat(cli): include linux DE and session type in tauri info (#11653)
This commit is contained in:
7
.changes/info-linux-de-and-session.md
Normal file
7
.changes/info-linux-de-and-session.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"tauri-cli": "patch:feat"
|
||||
"@tauri-apps/cli": "patch:feat"
|
||||
---
|
||||
|
||||
Include Linux destkop environment and session type in `tauri info` command.
|
||||
|
||||
@@ -175,17 +175,45 @@ fn is_xcode_command_line_tools_installed() -> bool {
|
||||
.map(|o| o.status.success())
|
||||
.unwrap_or(false)
|
||||
}
|
||||
fn de_and_session() -> String {
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd"
|
||||
))]
|
||||
return {
|
||||
let de = std::env::var("DESKTOP_SESSION");
|
||||
let session = std::env::var("XDG_SESSION_TYPE");
|
||||
format!(
|
||||
" ({} on {})",
|
||||
de.as_deref().unwrap_or("Unknown DE"),
|
||||
session.as_deref().unwrap_or("Unknown Session")
|
||||
)
|
||||
};
|
||||
|
||||
#[cfg(not(any(
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd"
|
||||
)))]
|
||||
String::new()
|
||||
}
|
||||
|
||||
pub fn items() -> Vec<SectionItem> {
|
||||
vec![
|
||||
SectionItem::new().action(|| {
|
||||
let os_info = os_info::get();
|
||||
format!(
|
||||
"OS: {} {} {} ({:?})",
|
||||
"OS: {} {} {} ({:?}){}",
|
||||
os_info.os_type(),
|
||||
os_info.version(),
|
||||
os_info.architecture().unwrap_or("Unknown Architecture"),
|
||||
os_info.bitness()
|
||||
os_info.bitness(),
|
||||
de_and_session(),
|
||||
).into()
|
||||
}),
|
||||
#[cfg(windows)]
|
||||
|
||||
Reference in New Issue
Block a user