#Hide Sidebar by pressing `CTRL` + `.`

1 messages · Page 1 of 1 (latest)

robust umbra
#

This is just a neat hack I assembled since I don't need a fancy button or an official plugin, this works fine for my Vencord client.

Be wary, this is a script that you can run in the devtools console and it works with MY current theme which has a horizontal top bar (MaterialDiscord)

if you're planning on turning this into a proper plugin, please do credit me and consider making me a collaborator! my github is @cfuendev

window.sidebarHidden = false;

document.styleSheets[0].insertRule(`
.hiddensidebar-main {
    position: absolute !important;
    left: 0 !important;
    right: 0;
    bottom: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    flex-grow: 1;
}
`)

document.addEventListener('keydown', function(event) {
    // Check if Ctrl key is pressed and the '.' key is pressed simultaneously
    if (event.ctrlKey && event.key === '.') {
        if (window.sidebarHidden) {
            document.querySelector("#app-mount > div.appAsidePanelWrapper__5e6e2 > div.notAppAsidePanel__95814 > div.app_b1f720 > div > div.layers__1c917.layers_a23c37 > div > div > div").classList.replace('hiddensidebar-main', 'base_c0676e')

            document.querySelector(".base_c0676e").style.top = 'var(--server-container)';

            document.querySelector("nav").style.opacity = 1;
            window.sidebarHidden = false;
        } else {
            document.querySelector("#app-mount > div.appAsidePanelWrapper__5e6e2 > div.notAppAsidePanel__95814 > div.app_b1f720 > div > div.layers__1c917.layers_a23c37 > div > div > div").classList.replace('base_c0676e', 'hiddensidebar-main')

            document.querySelector(".hiddensidebar-main").style.top = 'calc(var(--server-container) - ' + getComputedStyle(document.querySelector("nav")).width + ')';

            document.querySelector("nav").style.opacity = 0;
            window.sidebarHidden = true
        }
    }
});
delicate fossil
#

This is epic thanks

charred hawk
#

this is fire.

would it be possible to make the exact same thing (Toggle: Shift/Alt + "."), but for the server channel list?

boreal quail
#

works great for in some cases and in some servers

robust umbra
robust umbra
#

So now I'll get to work on your idea

#

@here

#

I got updated code, sorry for the ping

#

This one should work with your average sidebar-on-the-left theme

#

And also sidebar-at-the-top ones

charred hawk
robust umbra
#

Oh yeah, don't worry, I gotchu
I meant I finished the server list toggle, so now I will work on the channel toggle

charred hawk
#

Ah, alright. Gothca.

robust umbra
#

I'm having issues with the keyboard events, but I've already figured out the styles I need to toggle on and off to hide and show the channels list

robust umbra
#

Welp that sure took a bit, but I got it

robust umbra
robust umbra
charred hawk