For security, since this script injects CSS via AJAX, first fork the main slack night mode repo. The reason is explained here
UPDATE: The code has been modified to download the remote css to a local file and use ruby sass compiler to verify there is no malicious code in the remote css. This will error if the code has been modified to include anything malicious (i.e. script or img tags etc.) It's also been refactored to use the local file inside the js injection, it makes sure it's safe first in the very unlikely event the local file somehow differs from the remote css. The chances of this happening are remote, but this should suffice for safety.
- save this script wherever you keep your ruby scripts for example
~/lacostenycoder/scripts/ruby/
- change the URL in the
remote_repo
variable in ruby script to use YOUR repo. The rawgit.com file is created when you fork the repo. - For non-MacOS, find where the slack files are and replace line 20 to point to correct path, thanks simbalinux
so you would change line 20 for ubuntu like this
@file_target = '/usr/lib/slack/resources/app.asar.unpacked/src/static/'
- make script executable
sudo chmod +x nightslack
- symlink to a PATH load for example:
ln -s /Users/lacostenycoder/dev/ruby/nightslack.rb /usr/local/bin/nightslack
- Or if you prefer just drop the
.rb
from the filename and move it directly to/usr/local/bin/nightslack
From a terminal simply type nightslack
to start desktop app in night-mode.
To toggle back to day mode, simpley run nightslack -d
to pass the day mode option.
This will start or restart a running slack desktop in the desired mode!
- To update styles, sync your forked repo with upstream but be sure to inspect the css to insure it doesn't contain js code injeciton.
And how do I use this? I create a file with the name "nightslack.rb" and start it with the terminal?!