diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..efd7fff
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,32 @@
+name: test
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ branches:
+ - main
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
+
+ - name: Use Node.js 18
+ uses: actions/setup-node@v3
+ with:
+ node-version: 18
+ cache: "pnpm"
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Run tests
+ run: pnpm test
+
+ - name: Test if it compiles
+ run: |
+ pnpm build
+ pnpm build --dev
diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts
index bc7e0f7..d2f9233 100644
--- a/src/main/mainWindow.ts
+++ b/src/main/mainWindow.ts
@@ -15,6 +15,7 @@ import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally";
import { downloadVencordFiles } from "./utils/vencordLoader";
let isQuitting = false;
+let tray: Tray;
app.on("before-quit", () => {
isQuitting = true;
@@ -62,7 +63,7 @@ function initTray(win: BrowserWindow) {
}
]);
- const tray = new Tray(ICON_PATH);
+ tray = new Tray(ICON_PATH);
tray.setToolTip("Vencord Desktop");
tray.setContextMenu(trayMenu);
tray.on("click", () => win.show());
@@ -213,6 +214,10 @@ function initWindowBoundsListeners(win: BrowserWindow) {
}
function initSettingsListeners(win: BrowserWindow) {
+ Settings.addChangeListener("tray", enable => {
+ if (enable) initTray(win);
+ else tray?.destroy();
+ });
Settings.addChangeListener("disableMinSize", disable => {
if (disable) {
// 0 no work
@@ -262,7 +267,7 @@ export function createMainWindow() {
}));
win.on("close", e => {
- if (isQuitting || Settings.store.minimizeToTray === false) return;
+ if (isQuitting || Settings.store.minimizeToTray === false || Settings.store.tray === false) return;
e.preventDefault();
win.hide();
@@ -271,7 +276,7 @@ export function createMainWindow() {
});
initWindowBoundsListeners(win);
- initTray(win);
+ if (Settings.store.tray ?? true) initTray(win);
initMenuBar(win);
makeLinksOpenExternally(win);
initSettingsListeners(win);
diff --git a/src/renderer/components/Settings.tsx b/src/renderer/components/Settings.tsx
index dd957ba..6e5760e 100644
--- a/src/renderer/components/Settings.tsx
+++ b/src/renderer/components/Settings.tsx
@@ -21,12 +21,14 @@ export default function SettingsUi() {
Button
} = Common;
- const switches: [keyof typeof Settings, string, string, boolean?][] = [
+ const switches: [keyof typeof Settings, string, string, boolean?, (() => boolean)?][] = [
+ ["tray", "Tray Icon", "Add a tray icon for Vencord Desktop", true],
[
"minimizeToTray",
"Minimize to tray",
"Hitting X will make Vencord Desktop minimize to the tray instead of closing",
- true
+ true,
+ () => Settings.tray ?? true
],
[
"disableMinSize",
@@ -62,9 +64,10 @@ export default function SettingsUi() {
- {switches.map(([key, text, note, def]) => (
+ {switches.map(([key, text, note, def, predicate]) => (
(Settings[key] = v)}
note={note}
key={key}
diff --git a/src/shared/settings.d.ts b/src/shared/settings.d.ts
index 34c4035..cae4826 100644
--- a/src/shared/settings.d.ts
+++ b/src/shared/settings.d.ts
@@ -14,5 +14,6 @@ export interface Settings {
openLinksWithElectron?: boolean;
vencordDir?: string;
disableMinSize?: boolean;
+ tray?: boolean;
minimizeToTray?: boolean;
}