https://github.com/iyear/mousetrap-rs
Detect starting from Windows explorer in Rust
https://github.com/iyear/mousetrap-rs
cli mousetrap rust-library windows-api
Last synced: over 1 year ago
JSON representation
Detect starting from Windows explorer in Rust
- Host: GitHub
- URL: https://github.com/iyear/mousetrap-rs
- Owner: iyear
- License: mit
- Created: 2022-12-23T05:08:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-23T08:20:21.000Z (over 3 years ago)
- Last Synced: 2025-03-24T04:54:03.077Z (over 1 year ago)
- Topics: cli, mousetrap, rust-library, windows-api
- Language: Rust
- Homepage:
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mousetrap-rs
[](https://crates.io/crates/mousetrap)
[](https://docs.rs/mousetrap)
Rust implementation of https://github.com/inconshreveable/mousetrap, which is used in ngrok.
> mousetrap is a tiny library that answers a single question.
>
> On a Windows machine, was the process invoked by someone double-clicking on the executable file while browsing in explorer?
> `mousetrap` provides a way to detect these invocations so that you can provide more helpful behavior and instructions on how to run the CLI tool.
On non-Windows platforms, this library always returns `false`.
## Installation
Add this to your `Cargo.toml`:
```toml
[dependencies]
mousetrap = "0.1"
```
## Usage
```rust
use std::io;
fn main() {
println!("started_by_explorer: {}", mousetrap::started_by_explorer());
println!("Press Enter to exit...");
let mut s = String::new();
io::stdin().read_line(&mut s).unwrap();
}
```
## More
This is my first contribution to the Rust community. I hope you find it useful.
And I'm not familiar with Rust currently, so if you have any suggestions, feel free to open an issue or PR.
## License
MIT