diff --git a/.github/release-notes/v2.4.3.md b/.github/release-notes/v2.4.3.md new file mode 100644 index 0000000..d41e1f9 --- /dev/null +++ b/.github/release-notes/v2.4.3.md @@ -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) diff --git a/config/constants.py b/config/constants.py index d2f09c2..b68e0b0 100644 --- a/config/constants.py +++ b/config/constants.py @@ -2,7 +2,7 @@ import os import sys name = "Discord Rich Presence for Plex" -version = "2.4.2" +version = "2.4.3" plexClientID = "discord-rich-presence-plex" discordClientID = "413407336082833418" diff --git a/core/discord.py b/core/discord.py index b716cae..ae9aaa3 100644 --- a/core/discord.py +++ b/core/discord.py @@ -14,7 +14,13 @@ class DiscordIpcService: 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