Added FULL support for a LOT MORE apps :)
This commit is contained in:
parent
48d62ec2ab
commit
e69a0691c7
2 changed files with 34 additions and 16 deletions
36
src/app.rs
36
src/app.rs
|
@ -220,7 +220,7 @@ impl Apps {
|
||||||
kind: AppKind::Vegas,
|
kind: AppKind::Vegas,
|
||||||
default_project_name: "Vegas Project".to_string(),
|
default_project_name: "Vegas Project".to_string(),
|
||||||
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(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,13 +246,11 @@ impl App {
|
||||||
for (i, char) in window_title.chars().enumerate() {
|
for (i, char) in window_title.chars().enumerate() {
|
||||||
if char == '[' {
|
if char == '[' {
|
||||||
start_i = i;
|
start_i = i;
|
||||||
match window_title.find(".c4d]") {
|
if let Some(curr_end_i) = window_title.rfind("] - ") {
|
||||||
Some(i) => end_i = i as usize,
|
end_i = curr_end_i;
|
||||||
None => match window_title.find(" - Main") {
|
} else {
|
||||||
Some(i) => end_i = i as usize,
|
return self.default_project_name.clone();
|
||||||
None => end_i = window_title.len(),
|
}
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return window_title[start_i + 1..end_i].to_string();
|
return window_title[start_i + 1..end_i].to_string();
|
||||||
|
@ -262,10 +260,13 @@ impl App {
|
||||||
Some(i) => i + 5,
|
Some(i) => i + 5,
|
||||||
None => match window_title.as_str().find(".mb - Autodesk Maya") {
|
None => match window_title.as_str().find(".mb - Autodesk Maya") {
|
||||||
Some(i) => i + 4,
|
Some(i) => i + 4,
|
||||||
|
None => match window_title.as_str().find(" - Autodesk Maya") {
|
||||||
|
Some(i) => i,
|
||||||
None => {
|
None => {
|
||||||
return self.default_project_name.clone();
|
return self.default_project_name.clone();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
return window_title[..match_index as usize].to_string();
|
return window_title[..match_index as usize].to_string();
|
||||||
}
|
}
|
||||||
|
@ -289,10 +290,13 @@ impl App {
|
||||||
Some(i) => i + 5,
|
Some(i) => i + 5,
|
||||||
None => match window_title.as_str().find(".max - Autodesk 3ds Max") {
|
None => match window_title.as_str().find(".max - Autodesk 3ds Max") {
|
||||||
Some(i) => i + 4,
|
Some(i) => i + 4,
|
||||||
|
None => match window_title.as_str().find(" - Autodesk 3ds Max") {
|
||||||
|
Some(i) => i,
|
||||||
None => {
|
None => {
|
||||||
return self.default_project_name.clone();
|
return self.default_project_name.clone();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
return window_title[..match_index as usize].to_string();
|
return window_title[..match_index as usize].to_string();
|
||||||
}
|
}
|
||||||
|
@ -437,7 +441,21 @@ impl App {
|
||||||
AppKind::Audition => self.default_project_name.clone(),
|
AppKind::Audition => self.default_project_name.clone(),
|
||||||
AppKind::SubstancePainter => self.default_project_name.clone(),
|
AppKind::SubstancePainter => self.default_project_name.clone(),
|
||||||
AppKind::SubstanceDesigner => self.default_project_name.clone(),
|
AppKind::SubstanceDesigner => self.default_project_name.clone(),
|
||||||
AppKind::Vegas => self.default_project_name.clone(),
|
AppKind::Vegas => {
|
||||||
|
let match_index = match window_title.as_str().find(".veg* - VEGAS Pro") {
|
||||||
|
Some(i) => i + 5,
|
||||||
|
None => match window_title.as_str().find(".veg - VEGAS Pro") {
|
||||||
|
Some(i) => i + 4,
|
||||||
|
None => match window_title.as_str().find(" - VEGAS Pro") {
|
||||||
|
Some(i) => i,
|
||||||
|
None => {
|
||||||
|
return self.default_project_name.clone();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return window_title[..match_index as usize].to_string();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use windows::Win32::{
|
||||||
pub fn get_running_program(apps: &Apps) -> Option<(&App, String)> {
|
pub fn get_running_program(apps: &Apps) -> Option<(&App, String)> {
|
||||||
let running_window_names = unsafe { get_running_windows_titles() };
|
let running_window_names = unsafe { get_running_windows_titles() };
|
||||||
for window_name in running_window_names {
|
for window_name in running_window_names {
|
||||||
//dbg!(&window_name);
|
//println!("{}", &window_name);
|
||||||
if let Some(app) = apps.find_app(&window_name) {
|
if let Some(app) = apps.find_app(&window_name) {
|
||||||
if !window_name.contains("- Google Chrome") {
|
if !window_name.contains("- Google Chrome") {
|
||||||
//So googling it won't affect the DRP lol
|
//So googling it won't affect the DRP lol
|
||||||
|
|
Loading…
Reference in a new issue