| Crates.io | term-detect |
| lib.rs | term-detect |
| version | 0.1.8 |
| created_at | 2023-07-28 16:21:53.583792+00 |
| updated_at | 2024-11-28 16:53:02.548083+00 |
| description | Terminal emulator detector |
| homepage | |
| repository | https://gitlab.com/fnrir/term-detect |
| max_upload_size | |
| id | 928626 |
| size | 19,257 |
Terminal emulator detector
It works using 3 methods.
TERMINAL environment variableTERMINAL environment variable.$PATH search$PATH.Run fish in private mode in a terminal window. Don't close the window when the command ends.
use std::process::Command;
use term_detect::{DetectionError, InTerminalAuto};
fn main() -> Result<(), DetectionError> {
let child = Command::new("fish")
.arg("--private")
// Konsole-specific flag
.in_terminal_args(["--noclose"])?
.spawn()?
.wait()?;
Ok(())
}