razer-battery-report/src/main.rs

36 lines
947 B
Rust
Raw Normal View History

2024-09-03 22:46:04 +00:00
#![windows_subsystem = "windows"]
use tray::TrayApp;
2024-09-05 22:55:10 +00:00
use winapi::um::{self, wincon, winuser};
2024-08-27 18:08:03 +00:00
mod controller;
mod devices;
mod manager;
2024-09-03 22:46:04 +00:00
mod tray;
2024-08-27 18:08:03 +00:00
fn main() {
2024-09-05 22:55:10 +00:00
unsafe {
// Allocate new console for the process
um::consoleapi::AllocConsole();
// Modify the console window's style to remove the system menu (close, minimize, etc.).
winuser::SetWindowLongPtrW(
wincon::GetConsoleWindow(),
winuser::GWL_STYLE,
#[allow(clippy::cast_possible_wrap)]
{
winuser::GetWindowLongPtrW(wincon::GetConsoleWindow(), winuser::GWL_STYLE)
& !winuser::WS_SYSMENU as isize
},
);
// Hide the console window
winuser::ShowWindow(wincon::GetConsoleWindow(), winuser::SW_HIDE);
}
2024-08-27 18:08:03 +00:00
std::env::set_var("RUST_LOG", "trace");
pretty_env_logger::init();
2024-09-03 22:46:04 +00:00
let checker = TrayApp::new();
2024-08-27 18:08:03 +00:00
checker.run();
}