User scripts and stylesheets in Slack for OS X.
Because I got really annoyed that ⌘ + W
closed the
entire Slack window instead of the current channel, group, or direct message.
Also for fun.
$ curl -s https://zachsnow.github.io/slinger/slinger.sh | bash
This patches Slack.app
to load
slinger.js, a simple
user script that adds that missing shortcut (and allows access to the Developer Tools,
too).
If you'd prefer, you can patch Slack to load whatever user script you'd
like. Instead of executing slinger.sh
, download it then simply pass
the URL of the script as an argument:
$ bash slinger.sh https://someotherdomain.com/some-other-script.js
Caveats: the script must be served over HTTPS, with
a CA-signed certificate (otherwise the underlying WebView
will not deign to load it).
Slack.app
is an WebView
that loads
the Slack web application, so we just patch it to run some Javascript in
the context of the view.
That script then loads additional styles, adds elements to the page, binds keyboard shortcuts, and so on. It also ensures that the Developer Tools menu is always available.
Of course, you don't need to patch the app if you
don't want to; instead you can just open the Developer Tools (by
running Slack with the --dev
command-line option)
and enter the above code in the Console, everytime you start Slack.
But that's no fun!