Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ function getViewSubmenu(): Electron.MenuItemConstructorOptions[] {
}
},
},
{
label: t.__("Toggle Organization Shortcuts"),
click(_item, focusedWindow) {
if (focusedWindow) {
focusedWindow.webContents.send("toggleOrgShortcuts");
}
},
},
{
label: t.__("Toggle Sidebar"),
accelerator: "CommandOrControl+Shift+S",
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/js/components/server-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class ServerTab extends Tab {
<div class="server-tab">
<img class="server-icons" src="${this.props.icon}" />
</div>
<div class="server-tab-shortcut">${this.generateShortcutText()}</div>
<div class="server-tab-shortcut style="display:none"">${this.generateShortcutText()}</div>
</div>
`;
}
Expand Down
18 changes: 18 additions & 0 deletions app/renderer/js/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class ServerManagerView {
$loadingTooltip: HTMLElement;
$settingsTooltip: HTMLElement;
$serverIconTooltip: HTMLCollectionOf<HTMLElement>;
$serverShortcuts: HTMLCollectionOf<HTMLElement>;
$backTooltip: HTMLElement;
$dndTooltip: HTMLElement;
$sidebar: Element;
Expand Down Expand Up @@ -114,6 +115,10 @@ class ServerManagerView {
this.$serverIconTooltip = document.getElementsByClassName(
"server-tooltip",
) as HTMLCollectionOf<HTMLElement>;
// eslint-disable-next-line unicorn/prefer-query-selector
this.$serverShortcuts = document.getElementsByClassName(
"server-tab-shortcut",
) as HTMLCollectionOf<HTMLElement>;
this.$backTooltip = $actionsContainer.querySelector("#back-tooltip")!;
this.$dndTooltip = $actionsContainer.querySelector("#dnd-tooltip")!;

Expand Down Expand Up @@ -1025,6 +1030,19 @@ class ServerManagerView {
this.updateGeneralSettings("toggle-sidebar-setting", show);
});

ipcRenderer.on("toggleOrgShortcuts", () => {
for (const $serverShortcut of this.$serverShortcuts) {
if (
$serverShortcut.getAttribute("style") === null ||
$serverShortcut.getAttribute("style") === ""
) {
$serverShortcut.style.display = "none";
} else {
$serverShortcut.removeAttribute("style");
}
}
});

ipcRenderer.on("toggle-silent", (event: Event, state: boolean) => {
const webviews: NodeListOf<Electron.WebviewTag> = document.querySelectorAll(
"webview",
Expand Down