Skip to content

Add Flatpak Discord support and fix const qualifier warning#1

Open
raviheima wants to merge 1 commit into
tranarchy:mainfrom
raviheima:main
Open

Add Flatpak Discord support and fix const qualifier warning#1
raviheima wants to merge 1 commit into
tranarchy:mainfrom
raviheima:main

Conversation

@raviheima
Copy link
Copy Markdown

@raviheima raviheima commented May 12, 2026

Problem

Discord installed via Flatpak places the IPC socket at paths under XDG_RUNTIME_DIR instead of directly at the root, causing
dcfetch to fail with "Closed socket!" even when Discord is running.

Changes

  • Add subpaths[] array in get_ipc_path() (src/rpc.c) to search
    Flatpak-specific IPC socket locations:
    • /app/com.discordapp.Discord/
    • /.flatpak/com.discordapp.Discord/xdg-run/
  • Fix -Wdiscarded-qualifiers warning in src/audio/linux.c by
    changing char *strstr_ret to const char *strstr_ret

Tested on

Fedora Linux 44, KDE Plasma, Discord Flatpak

- Add subpaths[] array in get_ipc_path() to search Flatpak-specific

  IPC socket locations under XDG_RUNTIME_DIR, fixing dcfetch for

  users running Discord as a Flatpak package

- Fix -Wdiscarded-qualifiers warning in src/audio/linux.c by changing

  char *strstr_ret to const char *strstr_ret in node_event_info()
Copilot AI review requested due to automatic review settings May 12, 2026 10:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Discord IPC socket discovery logic to also find sockets created by Discord running as a Flatpak, and addresses a const-qualifier warning in the PipeWire audio integration.

Changes:

  • Extend get_ipc_path() to search additional Flatpak-specific subdirectories under candidate runtime dirs.
  • Fix a -Wdiscarded-qualifiers warning by making the strstr() result pointer const.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/rpc.c Adds Flatpak-specific subpaths to IPC socket lookup logic.
src/audio/linux.c Adjusts strstr() result to use const char * to avoid qualifier warnings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rpc.c
Comment on lines +30 to +33
for (size_t s = 0; s < sizeof(subpaths) / sizeof(subpaths[0]); s++) {
for (int j = 0; j < 10; j++) {
char ipc_path_buff[1024];
snprintf(ipc_path_buff, sizeof(ipc_path_buff), "%s%s/discord-ipc-%d", path, subpaths[s], j);
Comment thread src/rpc.c
Comment on lines 26 to +30
if (path == NULL)
continue;

for (int j = 0; j < 10; j++) {
char ipc_path_buff[1024];

for (size_t s = 0; s < sizeof(subpaths) / sizeof(subpaths[0]); s++) {
Comment thread src/audio/linux.c
Comment on lines 100 to 104
int substring_index = -1;

for (int i = 0; i < sizeof(substrings_to_remove) / sizeof(substrings_to_remove[0]); i++) {
char *strstr_ret = strstr(media_name, substrings_to_remove[i]);
const char *strstr_ret = strstr(media_name, substrings_to_remove[i]);
if (strstr_ret != NULL) {
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