diff options
author | Nick <nwowens32@gmail.com> | 2023-01-12 17:48:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 23:48:37 +0100 |
commit | 10fd51071e90c47b6cd0041fb1260ea284864905 (patch) | |
tree | d3a75d1fb0043f40cf4ae57a693c03baba88ddf6 | |
parent | e70abc57b6885e97dff54b89e752ab6df949bd67 (diff) | |
download | Vencord-10fd51071e90c47b6cd0041fb1260ea284864905.tar.gz Vencord-10fd51071e90c47b6cd0041fb1260ea284864905.tar.bz2 Vencord-10fd51071e90c47b6cd0041fb1260ea284864905.zip |
feat: Add option to disable the window frame (#400)
Co-authored-by: Ven <vendicated@riseup.net>
-rw-r--r-- | src/api/settings.ts | 2 | ||||
-rw-r--r-- | src/components/VencordSettings/VencordTab.tsx | 6 | ||||
-rw-r--r-- | src/patcher.ts | 9 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/api/settings.ts b/src/api/settings.ts index 2617903..384647c 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -30,6 +30,7 @@ export interface Settings { useQuickCss: boolean; enableReactDevtools: boolean; themeLinks: string[]; + frameless: boolean; plugins: { [plugin: string]: { enabled: boolean; @@ -43,6 +44,7 @@ const DefaultSettings: Settings = { useQuickCss: true, themeLinks: [], enableReactDevtools: false, + frameless: false, plugins: {} }; diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx index e59c449..9429cdd 100644 --- a/src/components/VencordSettings/VencordTab.tsx +++ b/src/components/VencordSettings/VencordTab.tsx @@ -106,6 +106,12 @@ function VencordSettings() { note="Shows a toast on startup"> Get notified about new updates </Switch> + <Switch + value={settings.frameless} + onChange={(v: boolean) => settings.frameless = v} + note="Requires a full restart"> + Disable the window frame + </Switch> </React.Fragment> )} diff --git a/src/patcher.ts b/src/patcher.ts index 96cb23c..4369782 100644 --- a/src/patcher.ts +++ b/src/patcher.ts @@ -65,12 +65,18 @@ if (!process.argv.includes("--vanilla")) { }; } + let settings = {} as any; + try { + settings = JSON.parse(readSettings()); + } catch { } + class BrowserWindow extends electron.BrowserWindow { constructor(options: BrowserWindowConstructorOptions) { if (options?.webPreferences?.preload && options.title) { const original = options.webPreferences.preload; options.webPreferences.preload = join(__dirname, "preload.js"); options.webPreferences.sandbox = false; + options.frame = settings.frameless; process.env.DISCORD_PRELOAD = original; @@ -118,8 +124,7 @@ if (!process.argv.includes("--vanilla")) { }); try { - const settings = JSON.parse(readSettings()); - if (settings.enableReactDevtools) + if (settings?.enableReactDevtools) installExt("fmkadmapgofadopljbjfkapdkoienihi") .then(() => console.info("[Vencord] Installed React Developer Tools")) .catch(err => console.error("[Vencord] Failed to install React Developer Tools", err)); |