1
1
mirror of https://github.com/neosubhamoy/pytubepp-helper.git synced 2026-02-04 11:22:22 +05:30

(refactor): switched to cli --hidden autostart method from WebSockets and fixed macOS autostart not auto hiding after restart issue

This commit is contained in:
2024-12-29 19:29:37 +05:30
Verified
parent 5eef3d01f7
commit e1be9e86a0
16 changed files with 33 additions and 131 deletions

View File

@@ -170,10 +170,15 @@ fn download_stream(url: String, stream: String) {
#[tokio::main]
async fn main() {
let _ = fix_path_env::fix();
let args: Vec<String> = env::args().collect();
let start_hidden = args.contains(&"--hidden".to_string());
let websocket_state = Arc::new(Mutex::new(WebSocketState {
sender: None,
response_channel: ResponseChannel { sender: None },
}));
let tray_menu = SystemTrayMenu::new()
.add_item(CustomMenuItem::new("show".to_string(), "Show"))
.add_item(CustomMenuItem::new("quit".to_string(), "Quit"));
@@ -207,6 +212,12 @@ async fn main() {
})
.manage(websocket_state.clone())
.setup(move |app| {
let window = app.get_window("main").unwrap();
if start_hidden {
window.hide().unwrap();
}
let app_handle = app.handle();
let ws_state = websocket_state.clone();
tokio::spawn(async move {