From 9b6175ca6d29e6f6d93e2c91e25af0553cbe0926 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sun, 25 Dec 2022 13:33:22 +0100
Subject: [PATCH] Rewrite capturer
---
src/ipc.ts | 1 -
src/preload/bridge.ts | 2 --
src/preload/preload.ts | 2 +-
src/preload/titlebar.ts | 47 -------------------------------
src/screenshare/main.ts | 37 +++++++++++++++++++++++++
src/screenshare/picker.html | 13 +++++++++
src/screenshare/preload.ts | 55 +++++++++++++++++++++++++++++++++++++
src/window.ts | 1 +
8 files changed, 107 insertions(+), 51 deletions(-)
create mode 100644 src/screenshare/main.ts
create mode 100644 src/screenshare/picker.html
create mode 100644 src/screenshare/preload.ts
diff --git a/src/ipc.ts b/src/ipc.ts
index be1ef00..8f7de82 100644
--- a/src/ipc.ts
+++ b/src/ipc.ts
@@ -143,5 +143,4 @@ export function registerIpc() {
event.returnValue = false;
}
});
- ipcMain.handle("DESKTOP_CAPTURER_GET_SOURCES", (event, opts) => desktopCapturer.getSources(opts));
}
diff --git a/src/preload/bridge.ts b/src/preload/bridge.ts
index 61cae4e..2008974 100644
--- a/src/preload/bridge.ts
+++ b/src/preload/bridge.ts
@@ -1,5 +1,4 @@
import {contextBridge, ipcRenderer} from "electron";
-import {getDisplayMediaSelector} from "./capturer";
import {injectTitlebar} from "./titlebar";
contextBridge.exposeInMainWorld("armcord", {
@@ -24,7 +23,6 @@ contextBridge.exposeInMainWorld("armcord", {
version: ipcRenderer.sendSync("get-app-version", "app-version"),
mods: ipcRenderer.sendSync("clientmod"),
packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"),
- getDisplayMediaSelector: getDisplayMediaSelector,
splashEnd: () => ipcRenderer.send("splashEnd"),
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
});
diff --git a/src/preload/preload.ts b/src/preload/preload.ts
index 64951b4..0a54b24 100644
--- a/src/preload/preload.ts
+++ b/src/preload/preload.ts
@@ -1,6 +1,6 @@
import {ipcRenderer} from "electron";
import "./bridge";
-import "./capturer";
+//import "./capturer";
import "./patch";
import * as fs from "fs";
import * as path from "path";
diff --git a/src/preload/titlebar.ts b/src/preload/titlebar.ts
index a82b766..5d869ad 100644
--- a/src/preload/titlebar.ts
+++ b/src/preload/titlebar.ts
@@ -54,54 +54,7 @@ export function injectTitlebar() {
});
});
}
-export function injectHummusTitlebar() {
- document.addEventListener("DOMContentLoaded", function (event) {
- var elem = document.createElement("div");
- elem.innerHTML = `
-
- `;
- elem.classList.add("win-buttons");
- elem.classList.add("win-buttons-light");
- document.getElementsByClassName("titlebar")[0].appendChild(elem);
- document.body.setAttribute("customTitlebar", "");
- document.body.setAttribute("hummus", "");
- document.body.setAttribute("armcord-platform", os.platform());
- addStyle(`
- html, body {
- background-color: #1e2124;
- }
-
- .friends-header,
- .chat > .title-wrap {
- float: right !important;
- padding-right: 140px !important;
- }`);
- var minimize = document.getElementById("minimize");
- var maximize = document.getElementById("maximize");
- var quit = document.getElementById("quit");
- minimize!.addEventListener("click", () => {
- ipcRenderer.send("win-minimize");
- });
-
- maximize!.addEventListener("click", () => {
- if (ipcRenderer.sendSync("win-isMaximized") == true) {
- ipcRenderer.send("win-unmaximize");
- document.body.removeAttribute("isMaximized");
- } else if (ipcRenderer.sendSync("win-isNormal") == true) {
- ipcRenderer.send("win-maximize");
- }
- });
-
- quit!.addEventListener("click", () => {
- if (ipcRenderer.sendSync("minimizeToTray") === true) {
- ipcRenderer.send("win-hide");
- } else if (ipcRenderer.sendSync("minimizeToTray") === false) {
- ipcRenderer.send("win-quit");
- }
- });
- });
-}
export function fixTitlebar() {
var elem = document.createElement("div");
elem.innerHTML = `