Hide Download Desktop app button

This commit is contained in:
Vendicated 2023-04-05 05:31:44 +02:00
parent cf23b6d028
commit d9f2b15e84
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
5 changed files with 17 additions and 3 deletions

View file

@ -1,7 +1,8 @@
import { app, ipcMain, shell } from "electron";
import { readFileSync } from "fs";
import { readFile } from "fs/promises";
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 { mainWin } from "./mainWindow";
import { PlainSettings, setSettings } from "./settings";
@ -14,6 +15,8 @@ ipcMain.on(GET_RENDERER_SCRIPT, e => {
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 => {
e.returnValue = PlainSettings;
});

View file

@ -1,5 +1,5 @@
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";
contextBridge.exposeInMainWorld("VencordDesktop", VencordDesktop);
@ -7,3 +7,4 @@ contextBridge.exposeInMainWorld("VencordDesktop", VencordDesktop);
require(ipcRenderer.sendSync(GET_VENCORD_PRELOAD_FILE));
webFrame.executeJavaScript(ipcRenderer.sendSync(GET_RENDERER_SCRIPT));
ipcRenderer.invoke(GET_RENDERER_STYLES).then(s => webFrame.insertCSS(s));

View file

@ -1,3 +1,5 @@
import "./hideGarbage.css";
// Make clicking Notifications focus the window
const originalSetOnClick = Object.getOwnPropertyDescriptor(Notification.prototype, "onclick")!.set!;
Object.defineProperty(Notification.prototype, "onclick", {

View 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;
}

View file

@ -1,7 +1,10 @@
export const GET_VENCORD_PRELOAD_FILE = "VCD_GET_VC_PRELOAD_FILE";
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 FOCUS = "VC_FOCUS";
export const SHOW_ITEM_IN_FOLDER = "VCD_SHOW_ITEM_IN_FOLDER";
export const GET_SETTINGS = "VCD_GET_SETTINGS";
export const SET_SETTINGS = "VCD_SET_SETTINGS";
export const FOCUS = "VC_FOCUS";