Add Flatpak Discord support and fix const qualifier warning#1
Open
raviheima wants to merge 1 commit into
Open
Conversation
- 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()
There was a problem hiding this comment.
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-qualifierswarning by making thestrstr()result pointerconst.
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 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 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 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
subpaths[]array inget_ipc_path()(src/rpc.c) to searchFlatpak-specific IPC socket locations:
/app/com.discordapp.Discord//.flatpak/com.discordapp.Discord/xdg-run/-Wdiscarded-qualifierswarning insrc/audio/linux.cbychanging
char *strstr_rettoconst char *strstr_retTested on
Fedora Linux 44, KDE Plasma, Discord Flatpak