Last active
March 25, 2019 21:37
-
-
Save andy-s-clark/e0e74b6e6652343ef5147ba82cf8756a to your computer and use it in GitHub Desktop.
Enable night-mode for Slack, using the buildcom fork of slack-night-mode
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 | |
if [ -f '/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js' ]; then | |
target='/usr/lib/slack/resources/app.asar.unpacked/src/static/ssb-interop.js' | |
elif [ -f '/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js' ]; then | |
target='/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js' | |
fi | |
if [ "z${target}" = "z" ]; then | |
echo 'Unsupported platform or Slack is not installed' | |
exit 1 | |
fi | |
if [ "$(pidof slack)" != "" ]; then | |
echo 'Please close Slack' | |
exit 2 | |
fi | |
if [ $(grep -c 'slack-night-mode' $target) -eq 0 ]; then | |
sudo cp "${target}" "${target}.bak" | |
cat <<EOF| sudo tee -a $target > /dev/null | |
document.addEventListener('DOMContentLoaded', function() { | |
\$.ajax({ | |
url: 'https://raw.githubusercontent.com/buildcom/slack-night-mode/master/css/raw/black.css', | |
success: function(css) { | |
\$("<style></style>").appendTo('head').html(css); | |
} | |
}); | |
}); | |
EOF | |
echo 'Set up complete' | |
else | |
echo 'Already set up' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment