Last active
January 24, 2019 09:32
-
-
Save starstuck/ea77a844554ac370d1fb1e0f59d0b73e to your computer and use it in GitHub Desktop.
Install Slack black theme on macOS
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
#!/usr/bin/env bash | |
sudo mkdir -p /Library/Application\ Support/Slack/Resources | |
curl https://raw.githubusercontent.com/laCour/slack-night-mode/master/css/raw/black.css | sudo tee /Library/Application\ Support/Slack/Resources/black.css > /dev/null | |
sudo patch --backup /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js << EOF | |
*** ssb-interop.js | |
--- ssb-interop.js.patched | |
*************** | |
*** 95,99 **** | |
const mainModule = require.resolve('../ssb/main.ts'); | |
const isDevMode = loadSettings.devMode && isPrebuilt(); | |
init(resourcePath, mainModule, !isDevMode); | |
} | |
--- 95,111 ---- | |
const mainModule = require.resolve('../ssb/main.ts'); | |
const isDevMode = loadSettings.devMode && isPrebuilt(); | |
+ const fs = require('fs'); | |
+ const blackCss = (() => { | |
+ try { | |
+ return fs.readFileSync('/Library/Application Support/Slack/Resources/black.css', { encoding: 'utf-8' }); | |
+ } catch (err) { | |
+ return ''; | |
+ } | |
+ })(); | |
+ document.addEventListener('DOMContentLoaded', function() { | |
+ \$('<style></style>').appendTo('head').html(blackCss); | |
+ }); | |
+ | |
init(resourcePath, mainModule, !isDevMode); | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment