Last active
September 25, 2018 20:06
-
-
Save squatto/286ebe6117d1ece145e798275e651976 to your computer and use it in GitHub Desktop.
Add code to Slack to make it use a dark theme, then kill and re-open Slack. Only adds the code if it isn't there already.
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
#!/bin/bash | |
# make Slack use a dark theme css next time it loads | |
SCRIPT=" | |
//DARKSLACK | |
document.addEventListener('DOMContentLoaded', function() { | |
\$.ajax({ | |
url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css', | |
success: function(css) { | |
\$('<style></style>').appendTo('head').html(css); | |
} | |
}); | |
}); | |
" | |
FILE=/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js | |
# append the script if it isn't already there | |
if grep -qF -- "//DARKSLACK" $FILE; then | |
echo "Slack is already dark, silly" | |
else | |
echo "Hello darkness my old friend..." | |
# append the script (pipe to grep to suppress the echo to stdout) | |
echo "$SCRIPT" | sudo tee -a $FILE | grep -q fdklsajf | |
# kill and run Slack | |
sudo killall Slack | |
open /Applications/Slack.app | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then just run
dark-slack
whenever Slack updates 👍