Skip to content

Commit

Permalink
fix; wayland audio share
Browse files Browse the repository at this point in the history
  • Loading branch information
smartfrigde committed Apr 28, 2024
1 parent e1e472b commit 4c1aeef
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 121 deletions.
2 changes: 0 additions & 2 deletions assets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
"settings-channel-desc4": "public test build. Receives features earlier than stable but is a bit older than Canary.",
"settings-invitewebsocket": "Rich Presence (Experimental)",
"settings-invitewebsocket-desc": "Uses <a target=\"_blank\" href=\"https://github.com/OpenAsar/arrpc\">arRPC</a> to support Discord RPC (Rich Presence) with local programs on your machine. Work in progress.",
"settings-altPaste": "Alternative Paste",
"settings-altPaste-desc": "If you're on Gnome on Linux or just simply can't paste images copied from other messages, then this is\n for you. This enables alternative module for pasting images. Only enable this when you're experiencing\n issues.",
"settings-mod": "Client mod",
"settings-mod-desc1": "Client mods are programs that allow you customize your Discord experience. They can change appearance of\n the client, modify behaviours or add new features!",
"settings-mod-vencord": "lightweight, and easy to use client mod. Features a built-in store for plugins.",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"start": "npm run build && electron ./ts-out/main.js",
"startThemeManager": "npm run build && electron ./ts-out/main.js themes",
"startKeybindManager": "npm run build && electron ./ts-out/main.js keybinds",
"startWayland": "npm run build && electron ./ts-out/main.js --ozone-platform-hint=auto --enable-features=WebRTCPipeWireCapturer,WaylandWindowDecorations",
"startWayland": "npm run build && electron ./ts-out/main.js --ozone-platform-hint=auto --enable-features=WebRTCPipeWireCapturer,WaylandWindowDecorations --disable-gpu",
"package": "npm run build && electron-builder",
"packageQuick": "npm run build && electron-builder --dir",
"format": "prettier --write src *.json",
Expand Down
3 changes: 0 additions & 3 deletions src/content/css/settingsEng.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
.acMobileMode {
height: 11em !important;
}
.acAltPaste {
height: 11em !important;
}
.acChannel {
height: 21em !important;
}
Expand Down
65 changes: 0 additions & 65 deletions src/content/js/patchAudio.js

This file was deleted.

27 changes: 0 additions & 27 deletions src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,6 @@ function paste(contents: any): void {
contents.paste();
}
export async function setMenu(): Promise<void> {
if ((await getConfig("alternativePaste")) == true) {
mainWindow.on("focus", function () {
console.log("[Window state manager] Focus");
globalShortcut.register("CmdOrCtrl+V", function () {
if (mainWindow.isFocused()) {
paste(mainWindow.webContents);
}
});
});
mainWindow.on("show", function () {
console.log("[Window state manager] Show");
mainWindow.focus();
globalShortcut.register("CmdOrCtrl+V", function () {
if (mainWindow.isFocused()) {
paste(mainWindow.webContents);
}
});
});
mainWindow.on("blur", function () {
console.log("[Window state manager] Defocus");
globalShortcut.unregister("CmdOrCtrl+V");
});
mainWindow.on("hide", function () {
console.log("[Window state manager] Hide");
globalShortcut.unregister("CmdOrCtrl+V");
});
}
let template: Electron.MenuItemConstructorOptions[] = [
{
label: "ArmCord",
Expand Down
14 changes: 4 additions & 10 deletions src/screenshare/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ let capturerWindow: BrowserWindow;
function registerCustomHandler(): void {
session.defaultSession.setDisplayMediaRequestHandler(async (request, callback) => {
console.log(request);
// if (process.platform == "linux") {
// let isAudio = isAudioSupported();
// if (isAudio) {
// console.log("audio supported");
// getSinks();
// }
// }
const sources = await desktopCapturer.getSources({
types: ["screen", "window"]
});
console.log(sources);
if (process.platform === "linux" && process.env.XDG_SESSION_TYPE?.toLowerCase() === "wayland") {
console.log("WebRTC Capturer detected, skipping window creation."); //assume webrtc capturer is used
console.log({video: {id: sources[0].id, name: sources[0].name}});
callback({video: {id: sources[0].id, name: sources[0].name}});
callback({video: sources[0], audio: "loopbackWithMute"});
} else {
capturerWindow = new BrowserWindow({
width: 800,
Expand All @@ -40,8 +33,9 @@ function registerCustomHandler(): void {
//console.log(sources[id]);
//console.log(id);
capturerWindow.close();
let result = {id, name, width: 9999, height: 9999};
if (process.platform === "linux") {
let result = {id, name};
if (process.platform === "linux" || process.platform === "win32") {
console.log("audio screenshare");
callback({video: result, audio: "loopbackWithMute"});
} else {
callback({video: result});
Expand Down
8 changes: 0 additions & 8 deletions src/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@
</div>
<br />

<div class="switch acAltPaste">
<label class="header" data-string="settings-altPaste"></label>
<input id="alternativePaste" class="tgl tgl-light left" data-setting="alternativePaste" type="checkbox" />
<label class="tgl-btn left" for="alternativePaste"></label>
<p class="description" data-string="settings-altPaste-desc"></p>
</div>
<br />

<div class="switch acAutogain">
<label class="header" data-string="settings-disableAutogain"></label>
<input id="disableAutogain" class="tgl tgl-light left" data-setting="disableAutogain" type="checkbox" />
Expand Down
1 change: 0 additions & 1 deletion src/setup/setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
useLegacyCapturer: false,
tray: /true/i.test(document.getElementById("tray").value),
startMinimized: false,
alternativePaste: false,
performanceMode: "none",
trayIcon: "default",
inviteWebsocket: true,
Expand Down
6 changes: 2 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export function setup(): void {
armcordCSP: true,
minimizeToTray: true,
keybinds: [],
alternativePaste: false,
multiInstance: false,
mods: "none",
spellcheck: true,
Expand Down Expand Up @@ -139,11 +138,11 @@ export async function injectElectronFlags(): Promise<void> {
switch (await getConfig("performanceMode")) {
case "performance":
console.log("Performance mode enabled");
app.commandLine.appendSwitch(presets.performance);
app.commandLine.appendArgument(presets.performance);
break;
case "battery":
console.log("Battery mode enabled");
app.commandLine.appendSwitch(presets.battery);
app.commandLine.appendArgument(presets.battery);
break;
default:
console.log("No performance modes set");
Expand Down Expand Up @@ -270,7 +269,6 @@ export interface Settings {
channel: string;
armcordCSP: boolean;
minimizeToTray: boolean;
alternativePaste: boolean;
multiInstance: boolean;
spellcheck: boolean;
mods: string;
Expand Down

0 comments on commit 4c1aeef

Please sign in to comment.