Hide Download Desktop app button
This commit is contained in:
parent
cf23b6d028
commit
d9f2b15e84
5 changed files with 17 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
||||||
import { app, ipcMain, shell } from "electron";
|
import { app, ipcMain, shell } from "electron";
|
||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
|
import { readFile } from "fs/promises";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { FOCUS, GET_RENDERER_SCRIPT, GET_SETTINGS, GET_VENCORD_PRELOAD_FILE, RELAUNCH, SET_SETTINGS, SHOW_ITEM_IN_FOLDER } from "../shared/IpcEvents";
|
import { FOCUS, GET_RENDERER_SCRIPT, GET_RENDERER_STYLES, GET_SETTINGS, GET_VENCORD_PRELOAD_FILE, RELAUNCH, SET_SETTINGS, SHOW_ITEM_IN_FOLDER } from "../shared/IpcEvents";
|
||||||
import { VENCORD_FILES_DIR } from "./constants";
|
import { VENCORD_FILES_DIR } from "./constants";
|
||||||
import { mainWin } from "./mainWindow";
|
import { mainWin } from "./mainWindow";
|
||||||
import { PlainSettings, setSettings } from "./settings";
|
import { PlainSettings, setSettings } from "./settings";
|
||||||
|
@ -14,6 +15,8 @@ ipcMain.on(GET_RENDERER_SCRIPT, e => {
|
||||||
e.returnValue = readFileSync(join(__dirname, "renderer.js"), "utf-8");
|
e.returnValue = readFileSync(join(__dirname, "renderer.js"), "utf-8");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle(GET_RENDERER_STYLES, () => readFile(join(__dirname, "renderer.css"), "utf-8"));
|
||||||
|
|
||||||
ipcMain.on(GET_SETTINGS, e => {
|
ipcMain.on(GET_SETTINGS, e => {
|
||||||
e.returnValue = PlainSettings;
|
e.returnValue = PlainSettings;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { contextBridge, ipcRenderer, webFrame } from "electron";
|
import { contextBridge, ipcRenderer, webFrame } from "electron";
|
||||||
import { GET_RENDERER_SCRIPT, GET_VENCORD_PRELOAD_FILE } from "../shared/IpcEvents";
|
import { GET_RENDERER_SCRIPT, GET_RENDERER_STYLES, GET_VENCORD_PRELOAD_FILE } from "../shared/IpcEvents";
|
||||||
import { VencordDesktop } from "./VencordDesktop";
|
import { VencordDesktop } from "./VencordDesktop";
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld("VencordDesktop", VencordDesktop);
|
contextBridge.exposeInMainWorld("VencordDesktop", VencordDesktop);
|
||||||
|
@ -7,3 +7,4 @@ contextBridge.exposeInMainWorld("VencordDesktop", VencordDesktop);
|
||||||
require(ipcRenderer.sendSync(GET_VENCORD_PRELOAD_FILE));
|
require(ipcRenderer.sendSync(GET_VENCORD_PRELOAD_FILE));
|
||||||
|
|
||||||
webFrame.executeJavaScript(ipcRenderer.sendSync(GET_RENDERER_SCRIPT));
|
webFrame.executeJavaScript(ipcRenderer.sendSync(GET_RENDERER_SCRIPT));
|
||||||
|
ipcRenderer.invoke(GET_RENDERER_STYLES).then(s => webFrame.insertCSS(s));
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import "./hideGarbage.css";
|
||||||
|
|
||||||
// Make clicking Notifications focus the window
|
// Make clicking Notifications focus the window
|
||||||
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;
|
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;
|
||||||
Object.defineProperty(Notification.prototype, "onclick", {
|
Object.defineProperty(Notification.prototype, "onclick", {
|
||||||
|
|
5
src/renderer/hideGarbage.css
Normal file
5
src/renderer/hideGarbage.css
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/* Download Desktop button in guilds list */
|
||||||
|
[class|=listItem]:has([data-list-item-id=guildsnav___app-download-button]),
|
||||||
|
[class|=listItem]:has(+ [class|=listItem] [data-list-item-id=guildsnav___app-download-button]) {
|
||||||
|
display: none;
|
||||||
|
}
|
|
@ -1,7 +1,10 @@
|
||||||
export const GET_VENCORD_PRELOAD_FILE = "VCD_GET_VC_PRELOAD_FILE";
|
export const GET_VENCORD_PRELOAD_FILE = "VCD_GET_VC_PRELOAD_FILE";
|
||||||
export const GET_RENDERER_SCRIPT = "VCD_GET_RENDERER_SCRIPT";
|
export const GET_RENDERER_SCRIPT = "VCD_GET_RENDERER_SCRIPT";
|
||||||
|
export const GET_RENDERER_STYLES = "VCD_GET_RENDERER_STYLES";
|
||||||
|
|
||||||
export const RELAUNCH = "VCD_RELAUNCH";
|
export const RELAUNCH = "VCD_RELAUNCH";
|
||||||
|
export const FOCUS = "VC_FOCUS";
|
||||||
|
|
||||||
export const SHOW_ITEM_IN_FOLDER = "VCD_SHOW_ITEM_IN_FOLDER";
|
export const SHOW_ITEM_IN_FOLDER = "VCD_SHOW_ITEM_IN_FOLDER";
|
||||||
export const GET_SETTINGS = "VCD_GET_SETTINGS";
|
export const GET_SETTINGS = "VCD_GET_SETTINGS";
|
||||||
export const SET_SETTINGS = "VCD_SET_SETTINGS";
|
export const SET_SETTINGS = "VCD_SET_SETTINGS";
|
||||||
export const FOCUS = "VC_FOCUS";
|
|
||||||
|
|
Loading…
Reference in a new issue