Fix app not closing and add Zbrush (General supp.)
This commit is contained in:
parent
2a33ef627a
commit
fa4d44488e
5 changed files with 34 additions and 11 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -251,7 +251,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "drp_creative"
|
name = "drp_creative"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"discord-rich-presence",
|
"discord-rich-presence",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "drp_creative"
|
name = "drp_creative"
|
||||||
version = "1.0.0"
|
version = "1.0.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
author = "https://djkato.net"
|
author = "https://djkato.net"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ discord-rich-presence = "0.2.2"
|
||||||
regex = "1.6.0"
|
regex = "1.6.0"
|
||||||
tray-item = "0.7.0"
|
tray-item = "0.7.0"
|
||||||
lazy_static = "1.4.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"
|
win-msgbox = "0.1.2"
|
||||||
|
|
||||||
[dependencies.windows]
|
[dependencies.windows]
|
||||||
|
|
BIN
program icons/zmanorig.png
Normal file
BIN
program icons/zmanorig.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
19
src/app.rs
19
src/app.rs
|
@ -30,6 +30,7 @@ pub enum AppKind {
|
||||||
SubstancePainter,
|
SubstancePainter,
|
||||||
SubstanceDesigner,
|
SubstanceDesigner,
|
||||||
Vegas,
|
Vegas,
|
||||||
|
ZBrush,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Apps {
|
pub struct Apps {
|
||||||
|
@ -52,10 +53,11 @@ pub struct Apps {
|
||||||
SubstancePainter: App,
|
SubstancePainter: App,
|
||||||
SubstanceDesigner: App,
|
SubstanceDesigner: App,
|
||||||
Vegas: App,
|
Vegas: App,
|
||||||
|
ZBrush: App,
|
||||||
}
|
}
|
||||||
impl Apps {
|
impl Apps {
|
||||||
pub fn as_iter(&self) -> [&App; 19] {
|
pub fn as_iter(&self) -> [&App; 20] {
|
||||||
let APPS: [&App; 19] = [
|
let APPS: [&App; 20] = [
|
||||||
&self.C4d,
|
&self.C4d,
|
||||||
&self.Maya,
|
&self.Maya,
|
||||||
&self.ThreeDsMax,
|
&self.ThreeDsMax,
|
||||||
|
@ -75,13 +77,14 @@ impl Apps {
|
||||||
&self.SubstancePainter,
|
&self.SubstancePainter,
|
||||||
&self.SubstanceDesigner,
|
&self.SubstanceDesigner,
|
||||||
&self.Vegas,
|
&self.Vegas,
|
||||||
|
&self.ZBrush,
|
||||||
];
|
];
|
||||||
APPS
|
APPS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl AppKind {
|
impl AppKind {
|
||||||
pub fn as_iter() -> [AppKind; 19] {
|
pub fn as_iter() -> [AppKind; 20] {
|
||||||
let APPKINDS: [AppKind; 19] = [
|
let APPKINDS: [AppKind; 20] = [
|
||||||
AppKind::C4d,
|
AppKind::C4d,
|
||||||
AppKind::Maya,
|
AppKind::Maya,
|
||||||
AppKind::ThreeDsMax,
|
AppKind::ThreeDsMax,
|
||||||
|
@ -101,6 +104,7 @@ impl AppKind {
|
||||||
AppKind::SubstancePainter,
|
AppKind::SubstancePainter,
|
||||||
AppKind::SubstanceDesigner,
|
AppKind::SubstanceDesigner,
|
||||||
AppKind::Vegas,
|
AppKind::Vegas,
|
||||||
|
AppKind::ZBrush,
|
||||||
];
|
];
|
||||||
APPKINDS
|
APPKINDS
|
||||||
}
|
}
|
||||||
|
@ -222,6 +226,12 @@ impl Apps {
|
||||||
drp_client_id: "1017882355723153448".to_string(),
|
drp_client_id: "1017882355723153448".to_string(),
|
||||||
process_search_string: "VEGAS Pro".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();
|
return window_title[..match_index as usize].to_string();
|
||||||
}
|
}
|
||||||
|
AppKind::ZBrush => self.default_project_name.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
src/main.rs
18
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]
|
#[macro_use]
|
||||||
extern crate self_update;
|
extern crate self_update;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ use crate::program_status::*;
|
||||||
use crate::self_updater::try_update;
|
use crate::self_updater::try_update;
|
||||||
use app::{App, Apps};
|
use app::{App, Apps};
|
||||||
use discord_rich_presence::{activity, DiscordIpc, DiscordIpcClient};
|
use discord_rich_presence::{activity, DiscordIpc, DiscordIpcClient};
|
||||||
|
use std::process::exit;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
use std::{thread, time};
|
use std::{thread, time};
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -32,7 +33,7 @@ fn main() {
|
||||||
let mut drp_is_running = false;
|
let mut drp_is_running = false;
|
||||||
let mut discord_client: Option<DiscordIpcClient> = None;
|
let mut discord_client: Option<DiscordIpcClient> = None;
|
||||||
let mut current_app_option: Option<&App> = None;
|
let mut current_app_option: Option<&App> = None;
|
||||||
'main: loop {
|
loop {
|
||||||
if let Some(current_app) = current_app_option {
|
if let Some(current_app) = current_app_option {
|
||||||
if let Some(real_project_name) = is_program_still_running(¤t_app) {
|
if let Some(real_project_name) = is_program_still_running(¤t_app) {
|
||||||
//if project name includes filtered words, use default project name
|
//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) => (),
|
Err(_err) => (),
|
||||||
}
|
}
|
||||||
} else {
|
} 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 nothing is running try to find it
|
||||||
if let Some(proj_name) = get_running_program(&apps) {
|
if let Some(proj_name) = get_running_program(&apps) {
|
||||||
let temp_curr_app: &App;
|
let temp_curr_app: &App;
|
||||||
|
|
Loading…
Reference in a new issue