Skip to content

Instantly share code, notes, and snippets.

@orenyomtov
Created April 18, 2018 12:07
Show Gist options
  • Save orenyomtov/3d0f2412afa1c4a9eb207d3d4310e988 to your computer and use it in GitHub Desktop.
Save orenyomtov/3d0f2412afa1c4a9eb207d3d4310e988 to your computer and use it in GitHub Desktop.
Add RTL support for Slack on Mac
# Prerequisites: Node.js
# Node.js can be installed using brew (https://brew.sh/) by running:
# brew install node
sudo echo "Killing Slack"
kill -9 $(ps aux | grep 'Slack' | awk '{print $2}')
echo "Installing asar"
npm install -g asar
cd /Applications/Slack.app/Contents/Resources
echo "Creating temporary directory to extract the source code into"
mkdir temp-sourcecode
echo "Extracting Slack’s source code"
sudo asar extract app.asar temp-sourcecode
echo "Editing Slack’s source code to add RTL support"
sudo tee -a temp-sourcecode/src/stat-cache.js 1>/dev/null <<EOL
if (typeof window !== 'undefined') {
window.addEventListener('DOMContentLoaded', function() {
jQuery('body').bind('DOMSubtreeModified', function() {
jQuery('.ql-editor, .c-message__body').attr('dir', 'auto').css('text-align', 'left');
});
}, false);
}
EOL
echo "Repacking Slack’s source code"
sudo asar pack temp-sourcecode app.asar
echo "Deleting temporary directory"
sudo rm -rf temp-sourcecode
cd ~
echo "Reopening Slack"
open /Applications/Slack.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment