Skip to content

Instantly share code, notes, and snippets.

@Dovias
Last active March 26, 2025 11:26
Show Gist options
  • Save Dovias/7f2a4d4cf86254e418a6adca9adb1f5f to your computer and use it in GitHub Desktop.
Save Dovias/7f2a4d4cf86254e418a6adca9adb1f5f to your computer and use it in GitHub Desktop.
Hide Discord app bar on web browser (New UI)
// ==UserScript==
// @name Hide Discord App Bar
// @namespace Violentmonkey Scripts
// @match *://discord.com/channels/*
// @grant none
// @version 1.0
// @author Dovias
// @source https://gist.github.com/Dovias/7f2a4d4cf86254e418a6adca9adb1f5f
// @description 3/25/2025, 10:11:25 PM
// ==/UserScript==
const regex = new RegExp("^bar_.+$");
new MutationObserver((records, observer) => {
for (record of records) {
for (const element of record.addedNodes) {
if (!regex.test(element.className)) continue;
element.parentElement.style = "--custom-app-top-bar-height: var(--space-sm)";
element.remove();
observer.disconnect();
return;
}
}
}).observe(document.body, { subtree: true, childList: true });
@Dovias
Copy link
Author

Dovias commented Mar 25, 2025

Before:
Before removal of the app bar
After:
After removal of the app bar

Add this script to userscript manager browser extension of your choice. I recommend ViolentMonkey since its free and open source.

Kinda hacky way to do this, since Discord loads elements dynamically, but I don't have enough motivation to do proper research on where to hook in order to properly hide this bar. It works perfectly fine, though.

@Dovias
Copy link
Author

Dovias commented Mar 25, 2025

Better Solution (UserStyle)

Just use UserStyle manager to load this UserStyle CSS stylesheet instead. I recommend Stylus since its free and open source.

This also fixes a delay issue that persists in UserScript where it hides the app bar completely after it was loaded.

@-moz-document regexp(".+://(www\\.)?discord\\.com/channels(/.*)?") {
[class^="bar_"] {
    display: none;
}

[class^="base_"] {
    --custom-app-top-bar-height: var(--space-sm);
}

Should also work with modded/custom discord clients with custom CSS support

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