Skip to content

Instantly share code, notes, and snippets.

@metafeather
Created October 31, 2024 15:44
Show Gist options
  • Save metafeather/8d59c83df526deedbd212031c26473e8 to your computer and use it in GitHub Desktop.
Save metafeather/8d59c83df526deedbd212031c26473e8 to your computer and use it in GitHub Desktop.
Userscript - SlackChannelHide
// ==UserScript==
// @name SlackChannelHide
// @namespace http://metafeather.net/
// @version 2024-10-31
// @description You can hide and open "CHANNELS" on Slack Web Client using Ctrl+S
// @author metafeather
// @match https://app.slack.com/client/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=slack.com
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const label = 'metafeather-net'
// Grid used to layout via areas:
// p-view_contents--sidebar
// p-view_contents--primary
//
// Override CSS with higher specificity
GM_addStyle ( `
body.${label} .p-ia4_client .p-client_workspace__layout {
grid-template-columns: 0 auto;
grid-template-areas: 'p-view_contents--sidebar p-view_contents--primary';
}
` );
// Use Mac Keyboard Left Option/Alt to show hide using CSS class
function doc_keyUp(e) {
if (e.ctrlKey && e.key === 's') {
document.body.classList.toggle(label)
}
}
document.addEventListener("keyup", doc_keyUp, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment