feat: Add option to disable the window frame (#400)
Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
e70abc57b6
commit
10fd51071e
3 changed files with 15 additions and 2 deletions
|
@ -30,6 +30,7 @@ export interface Settings {
|
||||||
useQuickCss: boolean;
|
useQuickCss: boolean;
|
||||||
enableReactDevtools: boolean;
|
enableReactDevtools: boolean;
|
||||||
themeLinks: string[];
|
themeLinks: string[];
|
||||||
|
frameless: boolean;
|
||||||
plugins: {
|
plugins: {
|
||||||
[plugin: string]: {
|
[plugin: string]: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
@ -43,6 +44,7 @@ const DefaultSettings: Settings = {
|
||||||
useQuickCss: true,
|
useQuickCss: true,
|
||||||
themeLinks: [],
|
themeLinks: [],
|
||||||
enableReactDevtools: false,
|
enableReactDevtools: false,
|
||||||
|
frameless: false,
|
||||||
plugins: {}
|
plugins: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,12 @@ function VencordSettings() {
|
||||||
note="Shows a toast on startup">
|
note="Shows a toast on startup">
|
||||||
Get notified about new updates
|
Get notified about new updates
|
||||||
</Switch>
|
</Switch>
|
||||||
|
<Switch
|
||||||
|
value={settings.frameless}
|
||||||
|
onChange={(v: boolean) => settings.frameless = v}
|
||||||
|
note="Requires a full restart">
|
||||||
|
Disable the window frame
|
||||||
|
</Switch>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
@ -65,12 +65,18 @@ if (!process.argv.includes("--vanilla")) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let settings = {} as any;
|
||||||
|
try {
|
||||||
|
settings = JSON.parse(readSettings());
|
||||||
|
} catch { }
|
||||||
|
|
||||||
class BrowserWindow extends electron.BrowserWindow {
|
class BrowserWindow extends electron.BrowserWindow {
|
||||||
constructor(options: BrowserWindowConstructorOptions) {
|
constructor(options: BrowserWindowConstructorOptions) {
|
||||||
if (options?.webPreferences?.preload && options.title) {
|
if (options?.webPreferences?.preload && options.title) {
|
||||||
const original = options.webPreferences.preload;
|
const original = options.webPreferences.preload;
|
||||||
options.webPreferences.preload = join(__dirname, "preload.js");
|
options.webPreferences.preload = join(__dirname, "preload.js");
|
||||||
options.webPreferences.sandbox = false;
|
options.webPreferences.sandbox = false;
|
||||||
|
options.frame = settings.frameless;
|
||||||
|
|
||||||
process.env.DISCORD_PRELOAD = original;
|
process.env.DISCORD_PRELOAD = original;
|
||||||
|
|
||||||
|
@ -118,8 +124,7 @@ if (!process.argv.includes("--vanilla")) {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const settings = JSON.parse(readSettings());
|
if (settings?.enableReactDevtools)
|
||||||
if (settings.enableReactDevtools)
|
|
||||||
installExt("fmkadmapgofadopljbjfkapdkoienihi")
|
installExt("fmkadmapgofadopljbjfkapdkoienihi")
|
||||||
.then(() => console.info("[Vencord] Installed React Developer Tools"))
|
.then(() => console.info("[Vencord] Installed React Developer Tools"))
|
||||||
.catch(err => console.error("[Vencord] Failed to install React Developer Tools", err));
|
.catch(err => console.error("[Vencord] Failed to install React Developer Tools", err));
|
||||||
|
|
Loading…
Reference in a new issue