Crates.io | crabtrap |
lib.rs | crabtrap |
version | 0.1.0 |
source | src |
created_at | 2024-10-15 21:44:21.027538 |
updated_at | 2024-10-15 21:44:21.027538 |
description | Detect whether your app was launched from the terminal or from explorer/PowerToys in Windows |
homepage | https://github.com/FrancescoLuzzi/crabtrap |
repository | https://github.com/FrancescoLuzzi/crabtrap |
max_upload_size | |
id | 1410734 |
size | 17,684 |
Rust porting of the golang library mousetrap
This is a tiny crate with a minimal footprint, that solves a simple problem:
Was the binary launched from the terminal or by double clicking on it?
This crate gives an answer in the Windows world, keeping the question open in all other operating systems (suggestions are welcome).
use crabtrap::started_by_explorer;
fn main(){
if started_by_explorer(){
println!("I'm from a GUI");
} else{
println!("I'm from the terminal");
}
}