fixed imports
This commit is contained in:
parent
cdbc00b3e5
commit
0157b85ae1
1 changed files with 9 additions and 9 deletions
|
@ -4,27 +4,27 @@
|
||||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import child_process from "node:child_process";
|
import { spawnSync } from "node:child_process";
|
||||||
import fs from "node:fs";
|
import { constants, open } from "node:fs";
|
||||||
import path from "node:path";
|
import { join } from "node:path";
|
||||||
|
|
||||||
import net from "net";
|
import { Socket } from "net";
|
||||||
import { IpcEvents } from "shared/IpcEvents";
|
import { IpcEvents } from "shared/IpcEvents";
|
||||||
|
|
||||||
import { mainWin } from "./mainWindow";
|
import { mainWin } from "./mainWindow";
|
||||||
|
|
||||||
const xdgRuntimeDir = process.env.XDG_RUNTIME_DIR || process.env.TMP || "/tmp";
|
const xdgRuntimeDir = process.env.XDG_RUNTIME_DIR || process.env.TMP || "/tmp";
|
||||||
const socketFile = path.join(xdgRuntimeDir, "vesktop-ipc");
|
const socketFile = join(xdgRuntimeDir, "vesktop-ipc");
|
||||||
|
|
||||||
export function initKeybinds() {
|
export function initKeybinds() {
|
||||||
child_process.spawnSync("mkfifo", [socketFile]);
|
spawnSync("mkfifo", [socketFile]);
|
||||||
fs.open(socketFile, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK, (err, fd) => {
|
open(socketFile, constants.O_RDONLY | constants.O_NONBLOCK, (err, fd) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error("Error opening pipe:", err);
|
console.error("Error opening pipe:", err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pipe = new net.Socket({ fd });
|
const pipe = new Socket({ fd });
|
||||||
pipe.on("data", data => {
|
pipe.on("data", data => {
|
||||||
const Actions = new Set([IpcEvents.TOGGLE_SELF_DEAF, IpcEvents.TOGGLE_SELF_MUTE]);
|
const Actions = new Set([IpcEvents.TOGGLE_SELF_DEAF, IpcEvents.TOGGLE_SELF_MUTE]);
|
||||||
const action = data.toString().trim();
|
const action = data.toString().trim();
|
||||||
|
@ -33,7 +33,7 @@ export function initKeybinds() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
pipe.on("end", () => {
|
pipe.once("end", () => {
|
||||||
pipe.destroy();
|
pipe.destroy();
|
||||||
initKeybinds();
|
initKeybinds();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue