Skip to content

Conversation

@F1zzTao
Copy link

@F1zzTao F1zzTao commented Jan 17, 2026

This change replaces the built-in process checking system for a running discord client. The current system only checks for official discord client processes. However, some people use unofficial discord clients like Vesktop, Vencord, betterdiscord, etc., so this app doesn't work with them as it can't find the discord process.

By checking the IPC path instead, we can find any running discord clients.

Only tested on Linux (CachyOS) with Vesktop, don't know about support for other systems and clients, but they should work as well.

@bas3line
Copy link
Owner

@greptile-apps Review this.

@greptile-apps
Copy link

greptile-apps bot commented Jan 17, 2026

Make sure you do the changes Sensei

Greptile Summary

This PR replaces process name-based Discord detection with IPC path checking using pypresence's get_ipc_path() function. This enables support for custom Discord clients like Vesktop, Vencord, and betterdiscord that don't use standard process names.

Key changes:

  • Removed DISCORD_PROCESS_NAMES constants from all config files
  • Replaced is_process_running(DISCORD_PROCESS_NAMES) with get_ipc_path() check in all three RPC modules
  • The new approach checks for Discord's IPC socket/pipe instead of specific process names

Benefits:

  • Works with any Discord client that implements Discord's IPC protocol
  • More reliable than process name matching
  • Reduces platform-specific configuration needs

Considerations:

  • get_ipc_path() should be wrapped in exception handling for robustness
  • The change maintains backward compatibility with official Discord clients

Confidence Score: 4/5

  • This PR is safe to merge with minor improvements recommended
  • The approach is sound and solves a real compatibility issue. The code changes are minimal and focused. However, the score is 4/5 rather than 5/5 because adding exception handling around get_ipc_path() calls would improve robustness. The logic is straightforward and the IPC-based detection is more reliable than process name matching.
  • The three RPC files (src/rpc.py, src/rpc_macos.py, src/rpc_windows.py) would benefit from exception handling around get_ipc_path() calls

Important Files Changed

Filename Overview
src/rpc.py Replaced process-based Discord detection with IPC path checking using get_ipc_path(), needs exception handling
src/rpc_macos.py Replaced process-based Discord detection with IPC path checking, needs exception handling
src/rpc_windows.py Replaced process-based Discord detection with IPC path checking, needs exception handling

Sequence Diagram

sequenceDiagram
    participant App as HytaleRPC App
    participant RPC as HytaleRPC.run()
    participant IPC as pypresence.get_ipc_path()
    participant Process as is_process_running()
    participant Discord as Discord Client (any)
    
    App->>RPC: Start monitoring loop
    loop Every 3 seconds
        RPC->>IPC: get_ipc_path()
        IPC->>Discord: Check IPC socket/pipe
        alt IPC path exists
            Discord-->>IPC: Return IPC path
            IPC-->>RPC: Returns path string
            RPC->>RPC: discord_on = True
        else IPC path not found
            Discord-->>IPC: No IPC available
            IPC-->>RPC: Returns None
            RPC->>RPC: discord_on = False
        end
        
        RPC->>Process: is_process_running(HYTALE_PROCESS_NAMES)
        Process-->>RPC: hytale_on status
        
        alt Hytale & Discord running + RPC inactive
            RPC->>RPC: Connect to Discord RPC
            RPC->>RPC: Set rpc_active = True
        else Hytale stopped + RPC active
            RPC->>RPC: Disconnect from Discord RPC
            RPC->>RPC: Set rpc_active = False
        else Discord stopped + RPC active
            RPC->>RPC: Clear connection state
            RPC->>RPC: Set rpc_active = False
        else RPC active
            RPC->>RPC: Update presence status
        end
    end
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile


while self.running:
discord_on = is_process_running(DISCORD_PROCESS_NAMES)
discord_on = True if get_ipc_path() else False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully

Suggested change
discord_on = True if get_ipc_path() else False
try:
discord_on = True if get_ipc_path() else False
except Exception:
discord_on = False
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc.py
Line: 79:79

Comment:
**style:** Wrap `get_ipc_path()` in try-except to handle potential exceptions gracefully

```suggestion
            try:
                discord_on = True if get_ipc_path() else False
            except Exception:
                discord_on = False
```

How can I resolve this? If you propose a fix, please make it concise.


while self.running:
discord_on = is_process_running(DISCORD_PROCESS_NAMES)
discord_on = True if get_ipc_path() else False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully

Suggested change
discord_on = True if get_ipc_path() else False
try:
discord_on = True if get_ipc_path() else False
except Exception:
discord_on = False
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc_macos.py
Line: 84:84

Comment:
**style:** Wrap `get_ipc_path()` in try-except to handle potential exceptions gracefully

```suggestion
            try:
                discord_on = True if get_ipc_path() else False
            except Exception:
                discord_on = False
```

How can I resolve this? If you propose a fix, please make it concise.


while self.running:
discord_on = is_process_running(DISCORD_PROCESS_NAMES)
discord_on = True if get_ipc_path() else False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Wrap get_ipc_path() in try-except to handle potential exceptions gracefully

Suggested change
discord_on = True if get_ipc_path() else False
try:
discord_on = True if get_ipc_path() else False
except Exception:
discord_on = False
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/rpc_windows.py
Line: 87:87

Comment:
**style:** Wrap `get_ipc_path()` in try-except to handle potential exceptions gracefully

```suggestion
            try:
                discord_on = True if get_ipc_path() else False
            except Exception:
                discord_on = False
```

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants