Skip to content

Commit

Permalink
Support for Flatpak version of Discord
Browse files Browse the repository at this point in the history
  • Loading branch information
phin05 committed Jan 4, 2024
1 parent b94ee58 commit 2bb484b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/release-notes/v2.4.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Release Notes

* Added support for Flatpak version of Discord (#75)

### Installation Instructions

* [Regular](https://github.com/phin05/discord-rich-presence-plex/blob/v2.4.3/README.md#installation)
* [Docker](https://github.com/phin05/discord-rich-presence-plex/blob/v2.4.3/README.md#run-with-docker)
2 changes: 1 addition & 1 deletion config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

name = "Discord Rich Presence for Plex"
version = "2.4.2"
version = "2.4.3"

plexClientID = "discord-rich-presence-plex"
discordClientID = "413407336082833418"
Expand Down
8 changes: 7 additions & 1 deletion core/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ def __init__(self, ipcPipeNumber: Optional[int]):
ipcPipeNumber = ipcPipeNumber or -1
ipcPipeNumbers = range(10) if ipcPipeNumber == -1 else [ipcPipeNumber]
ipcPipeBase = ("/run/app" if os.path.isdir("/run/app") else os.environ.get("XDG_RUNTIME_DIR", os.environ.get("TMPDIR", os.environ.get("TMP", os.environ.get("TEMP", "/tmp"))))) if isUnix else r"\\?\pipe"
self.ipcPipes = [os.path.join(ipcPipeBase, f"discord-ipc-{ipcPipeNumber}") for ipcPipeNumber in ipcPipeNumbers]
self.ipcPipes: list[str] = []
for ipcPipeNumber in ipcPipeNumbers:
pipeFilename = f"discord-ipc-{ipcPipeNumber}"
self.ipcPipes.append(os.path.join(ipcPipeBase, pipeFilename))
if ipcPipeBase == os.environ.get("XDG_RUNTIME_DIR"):
self.ipcPipes.append(os.path.join(ipcPipeBase, "app", "com.discordapp.Discord", pipeFilename))
self.ipcPipes.append(os.path.join(ipcPipeBase, ".flatpak", "com.discordapp.Discord", "xdg-run", pipeFilename))
self.loop: Optional[asyncio.AbstractEventLoop] = None
self.pipeReader: Optional[asyncio.StreamReader] = None
self.pipeWriter: Optional[asyncio.StreamWriter] = None
Expand Down

0 comments on commit 2bb484b

Please # to comment.