Skip to content

Instantly share code, notes, and snippets.

@Kenny-MWI
Last active April 16, 2024 19:00
Show Gist options
  • Star 45 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Kenny-MWI/6b1a88ad38b5ffef347527a82becf054 to your computer and use it in GitHub Desktop.
Save Kenny-MWI/6b1a88ad38b5ffef347527a82becf054 to your computer and use it in GitHub Desktop.
Slack Tweaks

Slack Tweaks

In Fall 2023, Slack introduced an updated client with some unpopular UI changes. The tweaks in this document can be used to revert to the old client or hide the new side bar. These will reset every time you fully close Slack but they are easy to re-apply once you get the hang of it.

(Cross Platform) Open Dev Tools [Preferred Option]

To run any of these scripts, you'll need to open the Dev Tools (or Console). You can do this by typing /slackdevtools in a Slack channel or direct message. These are the same Dev Tools you'd get in Chrome if you hit F12. Along the top are tabs for Elements, Console, Sources, Network, etc. You'll want to paste these scripts into the Console tab at the > prompt.

If Slack disables this command, then you can open Dev Tools by setting a system-wide environment variable and using a keyboard shortcut to open the console. If /slackdevtools worked for you then you can skip these next two sections.

(Mac OS) Enable Dev Mode

  1. Close the Slack app (command + Q)
  2. Open the terminal and run these two commands separately:
    • export SLACK_DEVELOPER_MENU=true
    • open /Applications/Slack.app
  3. Slack will re-open with but now we have access to its console
  4. Open Slack’s console by pressing command + option + I and clicking on the Console tab at the top
    • At the bottom of the console window you should see a blue > character. This is the prompt where you'll want to paste the code snippets found below.

Note If you close (cmd + q) or reload the app (cmd + r), you will have to do this again. There are instructions on how to make this permanent at the bottom of the document.

(Windows) Enable Dev Mode

  1. Close the Slack app if it's open (ctrl + Q or File -> Quit Slack)
  2. Add an environment variable SLACK_DEVELOPER_MENU with a value of true to your system
  3. Re-open Slack
  4. Open Slack's console by pressing ctrl + alt + I and clicking on the console tab at the top
    • At the bottom of the console window you should see a blue > character. This is the prompt where you'll want to paste the code snippets found below.

(GNU/Linux) Enable Dev Mode

Courtesy of @jm-janzen

  1. Close the Slack app (ctrl + Q)
  2. Open the terminal and run the following command:
    • SLACK_DEVELOPER_MENU=true /usr/bin/slack
  3. Slack will re-open with but now we have access to its console
  4. Open Slack’s console by pressing ctrl + alt + I and clicking on the Console tab at the top
    • At the bottom of the console window you should see a blue > character. This is the prompt where you'll want to paste the code snippets found below.

Revert to old client (pre-update)

Note: This is my preferred option and most likely the only one I will be maintaining moving forward.

You can completely revert (temporarily) to the old client by pasting this into the console:

localStorage.setItem("localConfig_v2", localStorage.getItem("localConfig_v2").replace(/\"is_unified_user_client_enabled\":true/g, '\"is_unified_user_client_enabled\":false'))

It'll probably return undefined, but that's fine. Reload Slack with command+R or ctrl+R and it should revert back until you restart Slack.


Merge Activity Tab with Workspace Switcher

You can remove the activity tab and merge it with the workspace switcher using the merge.js snippet from dkoes/slackfix. Check out that repo for a screenshot and more information. There's also a button.js in that repo to to show/hide the activity tab.


Hide the sidebar

If you like the new design and just want to hide the new sidebar paste the following into the console, courtesy of /u/CherryDT on reddit with a few edits by me:

document.querySelector('[data-qa="top-nav-help-button"]').parentNode.parentNode.parentNode.insertAdjacentElement('afterend', document.querySelector('[data-qa="user-button"]').parentNode.parentNode);
document.querySelector('.p-tab_rail').style.display = 'none';
document.querySelector('.p-control_strip').style.display = 'none';
document.querySelector('.p-ia4_client .p-client_workspace--including_tab_rail').style.gridTemplateAreas = 'p-client-workspace p-client-workspace';
document.querySelector('.p-ia4_client .p-client_workspace--including_tab_rail').className="p-theme_background";

This will hide the workspace switcher and you won't be able to see the "Mentions & reactions" link. It moves your profile image to the top right of the screen so you can still set your Slack status, pause notifications, edit preferences, etc. On mouseover, you'll see a tooltip block your profile image but you can click through it. I'm still working on a way to remove the tooltip.

According to @chipbite in the comments, if you have multiple workspaces can still switch using keyboard shortcuts. So, ctrl-1, ctrl-2, etc would still work to switch workspaces.

You can undo this change by restarting Slack if you change your mind or if it causes problems for you in the future.


Save a snippet

You can save snippets in your Dev Tools allowing you to quickly re-run them after Slack resets the interface. Open Dev Tools and go to the Sources tab. Just below the tabs, in the left pane, you'll probably see "Page", "Filesystem", and ">>". Click the ">>" button then "Snippets". Click + New snippet and paste your code into the window that opens on the right.

Any time you need to re-run the script, just come back to this window and run the snippet by pressing Cmd + Enter (Mac) or Ctrl + Enter (Windows).


(Mac OS) Set environment variable automatically

According to to @navels: If you want SLACK_DEVELOPER_MENU=true to be set whenever you log in, create a file in ~/Library/LaunchAgents/setenv.SLACK_DEVELOPER_MENU.plist with these contents. (I have not been able to get this to work on macOS 14 Sonoma.)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
  <dict>
  <key>Label</key>
  <string>setenv.SLACK_DEVELOPER_MENU</string>
  <key>ProgramArguments</key>
  <array>
    <string>/bin/launchctl</string>
    <string>setenv</string>
    <string>SLACK_DEVELOPER_MENU</string>
    <string>true</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>
@gab81
Copy link

gab81 commented Dec 3, 2023

I've updated my snippet above since it stopped working for me. Slack changed the class of one of the elements from .p-client_workspace--including_tab_rail to .p-client_workspace_wrapper

thanks, works again thank you!, just the overlay is weird if you have too many DM contacts, but easy to remove some...

image

@alex-enginity
Copy link

alex-enginity commented Dec 7, 2023

Is there any way we can simply insert CSS code?.

It so easy to hide the new look by simply tagging these classes:

.p-tab_rail.p-tab_rail__desktop {
display: none;
}

.p-ia4_client .p-client_workspace_wrapper {
grid-template: "p-tab-rail p-client-workspace" / 0px auto !important;
}

.p-control_strip {
display: none;
}

@dkoes
Copy link

dkoes commented Dec 8, 2023

Changing the css is exactly what the above snippets do…

@eidylon
Copy link

eidylon commented Dec 21, 2023

I've sent a support message through the website, as well as a "New UI Feedback" through the app.

But the fact that they keep changing the styles to break these scripts, when they could just as easily just add a "toggle" button for this stupid thing says to me that

a) they KNOW people hate it
b) they KNOW people are hackintoshing around it
c) they INSIST on forcing us to have it

Bad all around treatment of their user-base!

@gab81
Copy link

gab81 commented Dec 21, 2023 via email

@phlmike
Copy link

phlmike commented Dec 21, 2023

I sent a ticket in and I got: "We understand this will be an adjustment, but we hope that in time you will find this layout even more useful than the previous one. If there's anything else I can help with, or pass along for you, please let me know."
Like, Excuse Me? This is the "New Normal" mentality.

@alex-enginity
Copy link

There must be something we can do about this. I absolutely HATE that I need to hack this thing every time I open it. I swear to god I'm gonna leave Slack for good and migrate to something else and force all my customers to do the same.

@windowsrefund
Copy link

There must be something we can do about this. I absolutely HATE that I need to hack this thing every time I open it. I swear to god I'm gonna leave Slack for good and migrate to something else and force all my customers to do the same.

You shouldn't abandon your use and advocacy because of this problem but rather to the exposure to being controlled in this fashion. In other words, even if they fix "this" problem today, you are still 100% at their mercy every moment you use it.

@navels
Copy link

navels commented Dec 21, 2023

With respect, some of us are watching this gist for updates to the code. I'd suggest taking this conversation to /Slack or /SlackAlternatives on Reddit. Not trying to police this page since it isn't mine to begin with, just hoping to cut down on the notifications :-)

@gab81
Copy link

gab81 commented Dec 22, 2023

I've just sent feedback to Slack again and here's their reply now:

"We've been compiling all the feedback on the new sidebar.

You feedback has been added to the tracker as well. Our engineering team is closely monitoring it. However, we haven't decided yet whether we'll add the option to toggle it on/off.

I hope this helps clarifying."

@alex-enginity
Copy link

I want to send my feedback as well. Where can I do that?

@amstrudy
Copy link

I emailed them about an issue I was having while trying to actually properly use their horrendous new update (when removing workspaces from an enterprise... the channels themselves don't get removed from the sidebar? and this seems intentional? what kind of nonsense....). But this is what I got in response from slack:

"It isn't possible to turn of the new Unified Grid view. On Enterprise Grid, the Home view combines channels, direct messages and apps – from all your workspaces — into a single, comprehensive view.

This is designed so that you can easily find what you need without having to switch workspaces. With all communications, whether through channel or direct message now centralised, it should be easier to stay on top of important messages and updates."

It's giving there is no war in ba sing se....... "our new design is sooooo amazing how could anyone have any problems with it....."

@gab81
Copy link

gab81 commented Dec 22, 2023

I want to send my feedback as well. Where can I do that?

hi, i can't remember how i got into this one but they do reply me when i re-reply to that email i have from before -> Slack feedback+idXXXXX@slack.zendesk.com

I think is this

image

Then click on Contact Us or Give Feedback, then they'll generate an email and you can reply back to that one.

Oh Snap! looks like there's an update to install....... let's see what they messed up this time!

@dkoes
Copy link

dkoes commented Dec 22, 2023

@navels I've created a repository for my fix at least here: https://github.com/dkoes/slackfix/
You should be able to be more selective in what notifications you receive if you want to track that.
My goal is to spend as little time as needed to achieve the minimum functionality I need, but would love to receive contributions from others to improve my button code or alternative slack hacks.

@alex-enginity
Copy link

Feedback sent.

Curiously enough. I've provided both, Google Bard and ChatGPT-4 detailed screenshots of the "New Slack Design" and let them both come up with a piece of feedback for Slack.

This is what ChatGPT-4 wrote.
Hey Slack Team,

I've gotta say, I'm really not happy with this new sidebar thing you've rolled out. Seriously, what were you thinking? It's like you've taken a perfectly good workspace tool and turned it into a mess.

Look, I get it, change happens. But this? It's like a giant step backward. This sidebar is huge and clunky, and it's eating up all the space on my screen. It's making it super hard to get my work done efficiently. I mean, did anyone even ask for this?

And the worst part? We can't even turn it off or go back to the old style. That's just not cool. It feels like you're forcing this change on us without considering what we, the users, actually want or need.

You know, I've been fiddling with the developer mode trying to get rid of this eyesore. If a regular user like me can find a way to disable it, why can't you guys just give us an option to do so? It can't be that hard.

I've always liked Slack, but this move? Not cool. You really should listen to what your users are saying. We're the ones using it every day, after all.

Just my two cents. Hope you guys will reconsider this whole sidebar thing.

I've sent the feedback. Funny thing is that although Bard only gives "kind" feedback, it disagreed with the change, saying that it is counterproductive.

@alex-enginity
Copy link

alex-enginity commented Dec 22, 2023

Ok. If anyone else wants to send feedback to Slack. They are free to use this "feedback" I've asked from ChatGPT-4. It's hillarious.

_Hello Slack Wizards,

Wow, what a 'revolutionary' change with the new sidebar! I must say, you've really outdone yourselves this time. Who knew that what we all needed was a sidebar so big it deserves its own zip code? Genius!

I must admit, it's an impressive feat to take a perfectly functional workspace and turn it into a carnival of confusion. The way it dominates my screen, you'd think it was trying to win an award for 'Most Annoying Feature of the Year.'

And let's talk about the no opt-out option. Brilliant! It's like going to a restaurant and being told, 'You will have the mystery meal, and you WILL like it.' Democracy in action, Slack style.

I've been playing around in developer mode, trying to hide the behemoth you've unleashed. It's like a game of hide and seek, except I'm desperately trying to hide the sidebar, and it just wants to be seen.

I've always enjoyed using Slack, but this? It's like you guys decided one day, 'Hey, you know what our users need? A massive sidebar to make their work life just a bit more interesting.' Mission accomplished!

Thanks for the 'update.' It's been a real eye-opener – literally, I can't miss it.

Cheers,_

@dkoes
Copy link

dkoes commented Dec 22, 2023

I've added an alternative hack that instead of providing a button to show/hide the activity panel merges it with the workspace switcher (which you can show/hide with the standard shortcut if you want). Please star the repo if you find this useful.
https://github.com/dkoes/slackfix/blob/main/merge.js

@gab81
Copy link

gab81 commented Jan 1, 2024

I've added an alternative hack that instead of providing a button to show/hide the activity panel merges it with the workspace switcher (which you can show/hide with the standard shortcut if you want). Please star the repo if you find this useful. https://github.com/dkoes/slackfix/blob/main/merge.js

hi, this latest one you made doesn't work 100% for me, it removes the "double" sidebar but does not "merge with the workspace switcher" as you said. It looks clean though. Actually there's no more "+" sign at all.

@gab81
Copy link

gab81 commented Feb 18, 2024

I've added an alternative hack that instead of providing a button to show/hide the activity panel merges it with the workspace switcher (which you can show/hide with the standard shortcut if you want). Please star the repo if you find this useful. https://github.com/dkoes/slackfix/blob/main/merge.js

hi there, is there a way to have Slack launch https://github.com/dkoes/slackfix/blob/main/merge.js every time you re-launch it? like in Slack's startup? is that possible? thank you

@dkoes
Copy link

dkoes commented Feb 18, 2024

No

@Werkov
Copy link

Werkov commented Feb 28, 2024

FWIW, I had to update the hiding snippet due to some element not existing now (web UI):

wd = window.document;
wd.querySelector('[data-qa="top-nav-help-button"]').parentNode.parentNode.parentNode.insertAdjacentElement('afterend', wd.querySelector('[data-qa="user-button"]').parentNode.parentNode);
wd.querySelector('.p-tab_rail').style.display = 'none';
wd.querySelector('.p-control_strip').style.display = 'none';
wd.querySelector('.p-client_workspace_wrapper').style.display = 'block';
wd.querySelector('.p-client_workspace').style.height = '100%';

@dkoes
Copy link

dkoes commented Feb 28, 2024

Latest code is here. I use the merge code so that will be updated with fixes to slack changes as I experience them. Pull requests for the button code gratefully accepted.

@chx
Copy link

chx commented Feb 29, 2024

I have a simple version at https://gist.github.com/chx/22372925d1db05e19e76d7438262a575 which removes the rail containing Activity and moves the user + create new button to the bottom of the workspace switcher bar.

@jm-janzen
Copy link

jm-janzen commented Feb 29, 2024

@Werkov Your updated snippet is perfect. This worked exactly how I hoped (hid the superfluous sidebar, and gave me back the space it was using).

EDIT: Argh I spoke too soon. I get the following error when attempting to navigate to different channels. 😞

Error: REB8C8891C74

PS I've added linux instructions on a fork here. @Kenny-MWI if you want to incorporate, I can just delete this fork. 😄

@Kenny-MWI
Copy link
Author

Thanks, @jm-janzen, I'll add those instructions to my gist too. Although, I prefer just using the /slackdevtools command in Slack itself these days.

@Werkov
Copy link

Werkov commented Feb 29, 2024

Is /slackdevtools supposed to do anything with Slack in FF?

@Kenny-MWI
Copy link
Author

@Werkov no, it won't do anything in Firefox. In that case you would just need to press F12 on your keyboard or right click on the page and click "Inspect". I forgot Slack could be used in a browser so all of my instructions have been geared towards people using the standalone desktop app.

@briankendall
Copy link

briankendall commented Mar 19, 2024

In case anyone wants it, I took the method @Werkov figured out and adapted it to something that does some more things just to make the experience a little nicer:

  • Moves the home button into the top bar
  • Fixes the tooltip when mousing over the user button
  • Keeps all the necessary items hidden when switching between home and searching
  • Keeps checking for the existence of the sidebar before modifying it, for use in scripts that run when the page loads

Here's the code:

function tryToRemoveStupidSidebar() {
    function findWorkspace() {
        return document.querySelector('.p-client_workspace');
    }
    
    function findHomeIcon() {
        return document.querySelector('[data-qa="home-filled"]') || document.querySelector('[data-qa="home"]');
    }
    
    function sidebarIsLoaded() {
        return (document.querySelector('[data-qa="top-nav-help-button"]') !== null
                && document.querySelector('.p-tab_rail') !== null
                && document.querySelector('.p-control_strip') !== null
                && document.querySelector('.p-ia4_client .p-client_workspace_wrapper') !== null
                && findHomeIcon() !== null
                && findWorkspace() !== null);
    }
    
    function removeSidebar() {
        var insertionPointTopBar = document.querySelector('[data-qa="top-nav-help-button"]').parentNode.parentNode.parentNode;
        var insertionPointNavBar = document.querySelector('[data-qa="arrow-left"]').parentNode.parentNode.parentNode;
        var homeIcon = findHomeIcon();
        var homeOutline = homeIcon.parentNode.parentNode;
        var homeButton = homeOutline.parentNode.parentNode.parentNode;
        var homeLabel = homeButton.querySelector(".p-tab_rail__button__label");
        
        homeOutline.style.width = '30px';
        homeOutline.style.height = '30px';
        homeButton.style.width = '30px';
        homeLabel.style.display = "none";
        
        var lastUserButton = insertionPointTopBar.parentNode.querySelector('[data-qa="user-button"]');
        
        if (lastUserButton !== null) {
            lastUserButton.parentNode.parentNode.removeChild(lastUserButton.parentNode);
        } else {
            insertionPointNavBar.insertAdjacentElement('afterend', homeButton);
            document.querySelector('.p-tab_rail').style.display = 'none';
            document.querySelector('.p-client_workspace_wrapper').style.display = 'block';
        }
        
        findWorkspace().style.height = '100%';
        document.querySelector('.p-control_strip').style.display = 'none';
        
        var userButton = document.querySelector('[data-qa="user-button"]');
        userButton.style.marginLeft = '10px';
        insertionPointTopBar.insertAdjacentElement('afterend', userButton.parentNode.parentNode);
    }
    
    function checkForUserTooltip(mutations) {
        mutations.forEach(function(mutation) {
            for(var i = 0; i < mutation.addedNodes.length; ++i) {
                var newNode = mutation.addedNodes[i];
                
                if (newNode.className !== "ReactModalPortal") {
                    continue;
                }
                
                var tooltip = document.querySelector('[data-qa="tooltip-tip"]');
                
                if (tooltip === null) {
                    continue;
                }
                
                // Check to see if this is a left-pointing tooltip that's directly against the right
                // side of the window:
                
                if (!tooltip.classList.contains("c-tooltip__tip--right")
                    || !tooltip.classList.contains("c-tooltip__tip--small")) {
                    continue;
                }
                
                var container = tooltip.parentNode.parentNode;
                
                if (Math.abs(container.offsetLeft + container.offsetWidth - window.innerWidth) > 10) {
                    continue;
                }
                
                // Make it point to the right and shift it 40 pixels to the left:
                tooltip.classList.remove("c-tooltip__tip--right");
                tooltip.classList.add("c-tooltip__tip--left");
                container.style.left = (container.offsetLeft - 40) + 'px'
            }
        });
    }
    
    if (!sidebarIsLoaded()) {
        return false;
    }
    
    removeSidebar();
    
    // Need to rerun this whenever switching between home and searching
    var observer1 = new MutationObserver(removeSidebar);
    observer1.observe(findWorkspace().parentNode, { childList : true });
    
    // Fixes overlapping tooltip when mousing over the user button:
    var observer2 = new MutationObserver(checkForUserTooltip);
    observer2.observe(document.body, { childList : true });
    
    return true;
}

let count = 60;

function checkForSidebarTimer() {
    if (tryToRemoveStupidSidebar()) {
        return;
    }
    
    count--;
    
    if (count > 0) {
        setTimeout(checkForSidebarTimer, 500);
    }
}

checkForSidebarTimer();

I've got this in my Ferdium user.js file so that it automatically removes the sidebar when a Slack workspace loads. So far it's working well! Hopefully Slack doesn't change around the UI and break it before I have a chance to enjoy it for a bit.

@OstentatiousOtter
Copy link

In case anyone wants it, I took the method @Werkov figured out and adapted it to something that does some more things just to make the experience a little nicer:

  • Moves the home button into the top bar
  • Fixes the tooltip when mousing over the user button
  • Keeps all the necessary items hidden when switching between home and searching
  • Keeps checking for the existence of the sidebar before modifying it, for use in scripts that run when the page loads

Here's I commented out the code:

I've got this in my Ferdium user.js file so that it automatically removes the sidebar when a Slack workspace loads. So far it's working well! Hopefully Slack doesn't change around the UI and break it before I have a chance to enjoy it for a bit.

This code is working perfectly! I'm wondering what you mean by the user.js portion - I'd love to have this auto run when Slack loads.

@briankendall
Copy link

@OstentatiousOtter In Ferdium (or Franz too probably), each recipe has an optional user.js file where you can drop Javascript that you want to run each time a service loads. I put that code in my Slack user.js file. You can get at it by opening the service's settings, scrolling to the bottom and clicking the "Open user.js" button.

I'm not sure if there's any good way to do that when using Slack's app, other than manually opening the dev console and pasting it in. But maybe someone knows of a method.

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