Skip to content

Instantly share code, notes, and snippets.

Last active June 24, 2019 07:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Basically a starting point of hiding channels and blocking users in Slack
document.addEventListener("DOMContentLoaded", function() {
let hiddenChannels = ['general']
let blockedUsers = ['Slackbot']
let customCss = `
.p-channel_sidebar__static_list div[role="listitem"]:empty { display: none; }
hiddenChannels.concat(blockedUsers).forEach(it => {
customCss += `a[aria-label~="${it}"] { display: none; }\n`
let s = document.createElement('style');
s.type = 'text/css';
s.innerHTML = customCss;
let remover = function () {
setTimeout(function () {
hiddenChannels.forEach(it => {
document.querySelectorAll(`a[aria-label~="${it}"]`).forEach(it => it.remove());
blockedUsers.forEach(it => {
document.querySelectorAll(`a[aria-label~="${it}"]`).forEach(it => it.parentNode.remove());
}, 250);
Copy link

Akii commented Jun 24, 2019

Yes, I know. You might think: if you need this, something is wrong with your organisation. And maybe that's true. I just don't care and want more control about what I'm exposing myself to on Slack.

How to install:
Append Gist contents to this file: /Applications/

How it works:
It just adds some CSS and removes DOM elements. That means, you have to mute the channel you want to hide (usually, that's general). Regarding users: It will not hide notifications correctly. Not sure what to do about that yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment