It is now possible to set the refresh interval.
Update descriptions.
This commit is contained in:
16
README.md
16
README.md
@@ -84,7 +84,7 @@ You can also download a compiled version from [releases](https://github.com/Lenn
|
||||
|
||||
```
|
||||
hyper_headset_cli --help
|
||||
A CLI and tray application for monitoring and managing HyperX headsets.
|
||||
A CLI application for monitoring and managing HyperX headsets.
|
||||
|
||||
Usage: hyper_headset_cli [OPTIONS]
|
||||
|
||||
@@ -107,7 +107,19 @@ Options:
|
||||
```
|
||||
`hyper_headset_cli` without any arguments will print all available headset information.
|
||||
|
||||
`hyper_headset` without any arguments will start the tray application.
|
||||
```
|
||||
hyper_headset --help
|
||||
A CLI tray application for monitoring HyperX headsets.
|
||||
|
||||
Usage: hyper_headset [OPTIONS]
|
||||
|
||||
Options:
|
||||
--refresh_interval <refresh_interval> Set the refresh interval (in seconds)
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
`hyper_headset` without any arguments will start the tray application with a 3s refresh interval.
|
||||
Once it's open, hover over the headset icon in the system tray or right-click to view details such as the battery level.
|
||||
You can also exit via the right-clock menu.
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ fn main() {
|
||||
let matches = Command::new(env!("CARGO_PKG_NAME"))
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author(env!("CARGO_PKG_AUTHORS"))
|
||||
.about(env!("CARGO_PKG_DESCRIPTION"))
|
||||
.about("A CLI application for monitoring and managing HyperX headsets.")
|
||||
.arg(
|
||||
Arg::new("automatic_shutdown")
|
||||
.long("automatic_shutdown")
|
||||
|
||||
18
src/main.rs
18
src/main.rs
@@ -1,10 +1,26 @@
|
||||
use std::time::Duration;
|
||||
use clap::{Arg, Command};
|
||||
|
||||
mod status_tray;
|
||||
use hyper_headset::devices::connect_compatible_device;
|
||||
use status_tray::{StatusTray, TrayHandler};
|
||||
|
||||
fn main() {
|
||||
let matches = Command::new(env!("CARGO_PKG_NAME"))
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author(env!("CARGO_PKG_AUTHORS"))
|
||||
.about("A tray application for monitoring HyperX headsets.")
|
||||
.arg(
|
||||
Arg::new("refresh_interval")
|
||||
.long("refresh_interval")
|
||||
.required(false)
|
||||
.help(
|
||||
"Set the refresh interval (in seconds)",
|
||||
)
|
||||
.value_parser(clap::value_parser!(u64)),
|
||||
).get_matches();
|
||||
let refresh_interval = *matches.get_one::<u64>("refresh_interval").unwrap_or(&3);
|
||||
let refresh_interval = Duration::from_secs(refresh_interval);
|
||||
let tray_handler = TrayHandler::new(StatusTray::new());
|
||||
loop {
|
||||
let mut device = loop {
|
||||
@@ -17,7 +33,7 @@ fn main() {
|
||||
|
||||
// Run loop
|
||||
loop {
|
||||
std::thread::sleep(Duration::from_secs(1));
|
||||
std::thread::sleep(refresh_interval);
|
||||
match device.refresh_state() {
|
||||
Ok(()) => (),
|
||||
Err(error) => {
|
||||
|
||||
Reference in New Issue
Block a user