My discord was lagging increasingly during long calls on my Manjaro installation. I searched a bit on the Wiki but the fix shared there didn't work for. What worked for me is this answer on the Discord support forum, that I will detail a bit here. Start by moving to the right folder:
cd ~/.config/discord/<your_version>/modules/discord_desktop_core
Then, depending on whether you are a javascript developer or not, you may need to install the npm
package of your distribution.
On Arch/Manjaro, yay -S npm
will do. Once this is done, unpack the core.asar
file with
npx asar extract core.asar core
then open the discord_desktop_core
folder with your favorite editor. Now we need to change two things.
- Change the
setTrayIcon
in thediscord_desktop_core/core/app/systemTray.js
file so that it does nothing - Update the
discord_desktop_core/index.js
file to make it look for acore
folder instead of acore.asar
file
For the first part, open the file and replace the function with
function setTrayIcon(icon) {
return;
// Keep track of last set icon
currentIcon = trayIcons[icon]; // If icon is null, hide the tray icon. Otherwise show
// These calls also check for tray existence, so minimal cost.
if (icon == null) {
hide();
return;
} else {
show();
} // Keep mute/deafen menu items in sync with client, based on icon states
const muteIndex = contextMenu.indexOf(menuItems[MenuItems.MUTE]);
const deafenIndex = contextMenu.indexOf(menuItems[MenuItems.DEAFEN]);
const voiceConnected = contextMenu[muteIndex].visible;
let shouldSetContextMenu = false;
if (currentIcon !== trayIcons.DEFAULT && currentIcon !== trayIcons.UNREAD) {
// Show mute/deaf controls
if (!voiceConnected) {
contextMenu[muteIndex].visible = true;
contextMenu[deafenIndex].visible = true;
shouldSetContextMenu = true;
}
if (currentIcon === trayIcons.DEAFENED) {
contextMenu[muteIndex].checked = true;
contextMenu[deafenIndex].checked = true;
shouldSetContextMenu = true;
} else if (currentIcon === trayIcons.MUTED) {
contextMenu[muteIndex].checked = true;
contextMenu[deafenIndex].checked = false;
shouldSetContextMenu = true;
} else if (contextMenu[muteIndex].checked || contextMenu[deafenIndex].checked) {
contextMenu[muteIndex].checked = false;
contextMenu[deafenIndex].checked = false;
shouldSetContextMenu = true;
}
} else if (voiceConnected) {
contextMenu[muteIndex].visible = false;
contextMenu[deafenIndex].visible = false;
shouldSetContextMenu = true;
}
shouldSetContextMenu && setContextMenu();
atomTray != null && atomTray.setImage(_electron.nativeImage.createFromPath(currentIcon));
}
For the second part, replace the require
call in the index.js
file with
module.exports = require('./core');
Close any instance of discord you have running (be sure to close it and not just minimize it, in case you're not sure reboot your computer) and reopen Discord. You will probably need to apply this fix at each Discord update.
I noticed upon a recent update that the old version of this script breaks when multiple version folders are found, you can replace line 10 with the following to fix it:
path="$(find "$HOME/.config/discord" -name discord_desktop_core -type d | tail -n1)"
This just selects the path with the highest version, instead of erroring out because it attempts to select multiple versions.