diff --git a/Cargo.lock b/Cargo.lock index 63d56ad..4d59a66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -251,7 +251,7 @@ dependencies = [ [[package]] name = "drp_creative" -version = "1.0.3" +version = "1.0.4" dependencies = [ "discord-rich-presence", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 7671b1d..9676cc7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "drp_creative" -version = "1.0.3" +version = "1.0.4" edition = "2021" -author = "https://djkato.net" +authors = ["djkatovfx@gmail.com"] [dependencies] discord-rich-presence = "0.2.2" diff --git a/drp_config.toml b/drp_config.toml index e46e3a8..eb1d3c1 100644 --- a/drp_config.toml +++ b/drp_config.toml @@ -2,4 +2,4 @@ keywords_list = [] show_default_when_excluded = true portfolio_link = "djkato.net" hide_portfolio_row = false -should_list_include_or_exclude = "Include" +should_list_include_or_exclude = "Exclude" diff --git a/log.txt b/log.txt new file mode 100644 index 0000000..3316399 --- /dev/null +++ b/log.txt @@ -0,0 +1,2 @@ +'Process_list_dump.exe' is not recognized as an internal or external command, +operable program or batch file. diff --git a/src/app.rs b/src/app.rs index 0e1de9a..2ec1e8d 100644 --- a/src/app.rs +++ b/src/app.rs @@ -249,7 +249,16 @@ impl Apps { impl Apps { pub fn find_app(&self, str: &String) -> Option<&App> { for app in self.as_iter() { - if str.contains(&app.process_search_string) { + // if (str + // .to_lowercase() + // .contains(&app.process_search_string.to_ascii_lowercase())) + // { + // dbg!(str); + // } + if str + .to_lowercase() + .contains(&app.process_search_string.to_lowercase()) + { return Some(&app); } } @@ -261,19 +270,13 @@ impl App { pub fn parse(&self, window_title: &String) -> String { match self.kind { AppKind::C4d => { - let mut end_i: usize = window_title.len(); - let mut start_i: usize = 0; - for (i, char) in window_title.chars().enumerate() { - if char == '[' { - start_i = i; - if let Some(curr_end_i) = window_title.rfind("] - ") { - end_i = curr_end_i; - } else { - return self.default_project_name.clone(); - } + if let Some(split1) = window_title.rsplit_once("]") { + if let Some(split2) = split1.0.rsplit_once("[") { + dbg!(&split2.1); + return split2.1.to_string(); } } - return window_title[start_i + 1..end_i].to_string(); + return self.default_project_name.clone(); } AppKind::Maya => { let match_index = match window_title.as_str().find(".mb* - Autodesk Maya") { diff --git a/src/program_status.rs b/src/program_status.rs index 368b637..65cea13 100644 --- a/src/program_status.rs +++ b/src/program_status.rs @@ -8,7 +8,10 @@ pub fn get_running_program(apps: &Apps) -> Option<(&App, String)> { for window_name in running_window_names { //println!("{}", &window_name); if let Some(app) = apps.find_app(&window_name) { - if !window_name.contains("- Google Chrome") { + if !window_name.contains("- Google Chrome") + || !window_name.contains(" Mozilla Firefox") + || !window_name.contains("- Brave") + { //So googling it won't affect the DRP lol return Some((&app, app.parse(&window_name))); } @@ -20,8 +23,14 @@ pub fn is_program_still_running(app: &App) -> Option { let running_window_names = unsafe { get_running_windows_titles() }; for window_name in running_window_names { - if window_name.contains(&app.process_search_string) { - if !window_name.contains("- Google Chrome") { + if window_name + .to_lowercase() + .contains(&app.process_search_string.to_lowercase()) + { + if !window_name.contains("- Google Chrome") + || !window_name.contains(" Mozilla Firefox") + || !window_name.contains("- Brave") + { //So googling it won't affect the DRP lol return Some(app.parse(&window_name)); }