Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thororen1234 committed Oct 21, 2024
1 parent 7f98c36 commit f4267ae
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions src/main/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/

import dbus from "@homebridge/dbus-native";
import {
app,
BrowserWindow,
Expand Down Expand Up @@ -546,37 +545,5 @@ export async function createWindows() {
}

export function getAccentColor(): Promise<string> {
if (process.platform === "linux") {
return new Promise((resolve, reject) => {
const sessionBus = dbus.sessionBus();
sessionBus
.getService("org.freedesktop.portal.Desktop")
.getInterface(
"/org/freedesktop/portal/desktop",
"org.freedesktop.portal.Settings",
function (err, settings) {
if (err) {
resolve("");
return;
}
settings.Read("org.freedesktop.appearance", "accent-color", function (err, result) {
if (err) {
resolve("");
return;
}
const [r, g, b] = result[1][0][1][0];
const r255 = Math.round(r * 255);
const g255 = Math.round(g * 255);
const b255 = Math.round(b * 255);

const toHex = (value: number) => value.toString(16).padStart(2, "0");
const hexColor = `#${toHex(r255)}${toHex(g255)}${toHex(b255)}`;
resolve(hexColor);
});
}
);
});
} else {
return Promise.resolve(`#${systemPreferences.getAccentColor?.() || ""}`);
}
return Promise.resolve(`#${systemPreferences.getAccentColor?.() || ""}`);
}

0 comments on commit f4267ae

Please sign in to comment.