Last active
July 23, 2019 14:49
-
-
Save gkostov/592a0a8e0cc8f059635c7a5ccfd0a507 to your computer and use it in GitHub Desktop.
fixSlackTheme.sh for Slack 4 on OSX
This file contains 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
# !!!! make sure asar is available !!! | |
# npm install -g asar | |
# remove these to start afresh | |
rm -rf /Applications/Slack.app/Contents/Resources/app | |
rm -rf /Applications/Slack.app/Contents/Resources/app.asar.bak.unpacked | |
mv /Applications/Slack.app/Contents/Resources/app.asar /Applications/Slack.app/Contents/Resources/app.asar.bak 2>/dev/null | |
# asar needs the .unpacked dir to extract properly and we can just copy this one | |
cp -r /Applications/Slack.app/Contents/Resources/app.asar.unpacked /Applications/Slack.app/Contents/Resources/app.asar.bak.unpacked | |
echo "extracting Slack's app.asar"; | |
asar extract /Applications/Slack.app/Contents/Resources/app.asar.bak /Applications/Slack.app/Contents/Resources/app | |
echo "appending theme code to /Applications/Slack.app/Contents/Resources/app/dist/ssb-interop.bundle.js"; | |
cat << 'EOF' >> /Applications/Slack.app/Contents/Resources/app/dist/ssb-interop.bundle.js | |
document.addEventListener('DOMContentLoaded', function() { | |
const cssURI = 'https://gist.githubusercontent.com/gkostov/039fe18fac0c27a4350b274f83403dcb/raw/slack-dark-theme.css', | |
codeMirrorThemURI = 'https://gist.githubusercontent.com/pdsullivan/32bad68541ccb66ae6d4948f7c9e88bb/raw/f22e0f5de5ff25d$ | |
Promise.all([cssURI, codeMirrorThemURI].map((file)=>{ | |
return fetch(file) | |
.then( response => { | |
return response.text(); | |
}); | |
})).then(files => { | |
files[1] = files[1].replace(/cm-s-cobalt/g, 'cm-s-default'); | |
let styleEl = document.createElement('style'); | |
styleEl.appendChild(document.createTextNode(files.join('\n'))); | |
document.getElementsByTagName('head')[0].appendChild(styleEl); | |
}); | |
}); | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment