diff --git a/Cargo.lock b/Cargo.lock index a05ac90..ef1eb7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,7 +251,7 @@ dependencies = [ [[package]] name = "drp_creative" -version = "1.0.0" +version = "1.0.1" dependencies = [ "discord-rich-presence", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 5b1e7a4..69604d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "drp_creative" -version = "1.0.0" +version = "1.0.1" edition = "2021" author = "https://djkato.net" @@ -9,7 +9,7 @@ discord-rich-presence = "0.2.2" regex = "1.6.0" tray-item = "0.7.0" lazy_static = "1.4.0" -self_update = {version= "0.36.0", features= ["archive-zip"]} +self_update = { version = "0.36.0", features = ["archive-zip"] } win-msgbox = "0.1.2" [dependencies.windows] @@ -28,4 +28,4 @@ windres = "0.2.2" # prefix binary with x86_64-pc-windows-msvc for self_updater [[bin]] name = "DRP_Creative--x86_64-pc-windows-msvc" -path = "src/main.rs" \ No newline at end of file +path = "src/main.rs" diff --git a/program icons/zmanorig.png b/program icons/zmanorig.png new file mode 100644 index 0000000..da61861 Binary files /dev/null and b/program icons/zmanorig.png differ diff --git a/src/app.rs b/src/app.rs index 29fe02b..739237d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -30,6 +30,7 @@ pub enum AppKind { SubstancePainter, SubstanceDesigner, Vegas, + ZBrush, } pub struct Apps { @@ -52,10 +53,11 @@ pub struct Apps { SubstancePainter: App, SubstanceDesigner: App, Vegas: App, + ZBrush: App, } impl Apps { - pub fn as_iter(&self) -> [&App; 19] { - let APPS: [&App; 19] = [ + pub fn as_iter(&self) -> [&App; 20] { + let APPS: [&App; 20] = [ &self.C4d, &self.Maya, &self.ThreeDsMax, @@ -75,13 +77,14 @@ impl Apps { &self.SubstancePainter, &self.SubstanceDesigner, &self.Vegas, + &self.ZBrush, ]; APPS } } impl AppKind { - pub fn as_iter() -> [AppKind; 19] { - let APPKINDS: [AppKind; 19] = [ + pub fn as_iter() -> [AppKind; 20] { + let APPKINDS: [AppKind; 20] = [ AppKind::C4d, AppKind::Maya, AppKind::ThreeDsMax, @@ -101,6 +104,7 @@ impl AppKind { AppKind::SubstancePainter, AppKind::SubstanceDesigner, AppKind::Vegas, + AppKind::ZBrush, ]; APPKINDS } @@ -222,6 +226,12 @@ impl Apps { drp_client_id: "1017882355723153448".to_string(), process_search_string: "VEGAS Pro".to_string(), }, + ZBrush: App { + kind: AppKind::Vegas, + default_project_name: "ZBrush Project".to_string(), + drp_client_id: "1112734356855865425".to_string(), + process_search_string: "ZBrush".to_string(), + }, } } } @@ -456,6 +466,7 @@ impl App { }; return window_title[..match_index as usize].to_string(); } + AppKind::ZBrush => self.default_project_name.clone(), } } } diff --git a/src/main.rs b/src/main.rs index 4fd7f8b..af34810 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -#![windows_subsystem = "windows"] //UNCOMMENT ONLY WHEN BUILDING FOR RELEASE TO NOT SHOW TERMINAL WINDOW! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #[macro_use] extern crate self_update; @@ -12,6 +12,7 @@ use crate::program_status::*; use crate::self_updater::try_update; use app::{App, Apps}; use discord_rich_presence::{activity, DiscordIpc, DiscordIpcClient}; +use std::process::exit; use std::time::{SystemTime, UNIX_EPOCH}; use std::{thread, time}; fn main() { @@ -32,7 +33,7 @@ fn main() { let mut drp_is_running = false; let mut discord_client: Option = None; let mut current_app_option: Option<&App> = None; - 'main: loop { + loop { if let Some(current_app) = current_app_option { if let Some(real_project_name) = is_program_still_running(¤t_app) { //if project name includes filtered words, use default project name @@ -108,11 +109,22 @@ fn main() { } } } - tray_icon::Message::Quit => panic!(), + tray_icon::Message::Quit => { + println!("qiuitting!"); + exit(0) + } }, Err(_err) => (), } } else { + //respond to tray icon messages + match tray_receiver.try_recv() { + Ok(msg) => match msg { + tray_icon::Message::AnonymiseProject => {} + tray_icon::Message::Quit => exit(0), + }, + Err(_err) => (), + } //If nothing is running try to find it if let Some(proj_name) = get_running_program(&apps) { let temp_curr_app: &App;