Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
bd015a83f6 | |||
037ab2d409 | |||
![]() |
d43af93c99 | ||
![]() |
d2d00497e1 |
8 changed files with 28 additions and 19 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.3"
|
version = "1.0.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"discord-rich-presence",
|
"discord-rich-presence",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[package]
|
[package]
|
||||||
name = "drp_creative"
|
name = "drp_creative"
|
||||||
version = "1.0.3"
|
version = "1.0.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
author = "https://djkato.net"
|
authors = ["djkatovfx@gmail.com"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
discord-rich-presence = "0.2.2"
|
discord-rich-presence = "0.2.2"
|
||||||
|
|
1
FUNDING.yml
Normal file
1
FUNDING.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ko_fi: djkato
|
|
@ -1,3 +1,4 @@
|
||||||
|
<a href='https://ko-fi.com/A0A8Q3SVZ' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi4.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|
||||||
# Discord Rich Presence for Creative Apps
|
# Discord Rich Presence for Creative Apps
|
||||||
### Show your friends what you're working on, be it in Adobe Suite, Autodesk Suite, Cinema 4D or many more!
|
### Show your friends what you're working on, be it in Adobe Suite, Autodesk Suite, Cinema 4D or many more!
|
||||||
This app runs in the background and looks for processes, then parses the windows title and turns it into a project name to display with Discords Rich Presence.
|
This app runs in the background and looks for processes, then parses the windows title and turns it into a project name to display with Discords Rich Presence.
|
||||||
|
|
|
@ -2,4 +2,4 @@ keywords_list = []
|
||||||
show_default_when_excluded = true
|
show_default_when_excluded = true
|
||||||
portfolio_link = "djkato.net"
|
portfolio_link = "djkato.net"
|
||||||
hide_portfolio_row = false
|
hide_portfolio_row = false
|
||||||
should_list_include_or_exclude = "Include"
|
should_list_include_or_exclude = "Exclude"
|
||||||
|
|
2
log.txt
Normal file
2
log.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
'Process_list_dump.exe' is not recognized as an internal or external command,
|
||||||
|
operable program or batch file.
|
20
src/app.rs
20
src/app.rs
|
@ -249,7 +249,10 @@ impl Apps {
|
||||||
impl Apps {
|
impl Apps {
|
||||||
pub fn find_app(&self, str: &String) -> Option<&App> {
|
pub fn find_app(&self, str: &String) -> Option<&App> {
|
||||||
for app in self.as_iter() {
|
for app in self.as_iter() {
|
||||||
if str.contains(&app.process_search_string) {
|
if str
|
||||||
|
.to_lowercase()
|
||||||
|
.contains(&app.process_search_string.to_lowercase())
|
||||||
|
{
|
||||||
return Some(&app);
|
return Some(&app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,19 +264,12 @@ impl App {
|
||||||
pub fn parse(&self, window_title: &String) -> String {
|
pub fn parse(&self, window_title: &String) -> String {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
AppKind::C4d => {
|
AppKind::C4d => {
|
||||||
let mut end_i: usize = window_title.len();
|
if let Some(split1) = window_title.rsplit_once("]") {
|
||||||
let mut start_i: usize = 0;
|
if let Some(split2) = split1.0.rsplit_once("[") {
|
||||||
for (i, char) in window_title.chars().enumerate() {
|
return split2.1.to_string();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return window_title[start_i + 1..end_i].to_string();
|
return self.default_project_name.clone();
|
||||||
}
|
}
|
||||||
AppKind::Maya => {
|
AppKind::Maya => {
|
||||||
let match_index = match window_title.as_str().find(".mb* - Autodesk Maya") {
|
let match_index = match window_title.as_str().find(".mb* - Autodesk Maya") {
|
||||||
|
|
|
@ -8,7 +8,10 @@ pub fn get_running_program(apps: &Apps) -> Option<(&App, String)> {
|
||||||
for window_name in running_window_names {
|
for window_name in running_window_names {
|
||||||
//println!("{}", &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")
|
||||||
|
|| !window_name.contains(" Mozilla Firefox")
|
||||||
|
|| !window_name.contains("- Brave")
|
||||||
|
{
|
||||||
//So googling it won't affect the DRP lol
|
//So googling it won't affect the DRP lol
|
||||||
return Some((&app, app.parse(&window_name)));
|
return Some((&app, app.parse(&window_name)));
|
||||||
}
|
}
|
||||||
|
@ -20,8 +23,14 @@ pub fn is_program_still_running(app: &App) -> Option<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 {
|
||||||
if window_name.contains(&app.process_search_string) {
|
if window_name
|
||||||
if !window_name.contains("- Google Chrome") {
|
.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
|
//So googling it won't affect the DRP lol
|
||||||
return Some(app.parse(&window_name));
|
return Some(app.parse(&window_name));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue