feat: add translucency option for macOS (#849)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Ryan Cao 2023-04-09 10:06:09 +08:00 committed by GitHub
parent 08822dd190
commit 613fa9a57b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

@ -38,6 +38,7 @@ export interface Settings {
frameless: boolean; frameless: boolean;
transparent: boolean; transparent: boolean;
winCtrlQ: boolean; winCtrlQ: boolean;
macosTranslucency: boolean;
disableMinSize: boolean; disableMinSize: boolean;
winNativeTitleBar: boolean; winNativeTitleBar: boolean;
plugins: { plugins: {
@ -72,6 +73,7 @@ const DefaultSettings: Settings = {
frameless: false, frameless: false,
transparent: false, transparent: false,
winCtrlQ: false, winCtrlQ: false,
macosTranslucency: false,
disableMinSize: false, disableMinSize: false,
winNativeTitleBar: false, winNativeTitleBar: false,
plugins: {}, plugins: {},

@ -48,6 +48,7 @@ function VencordSettings() {
const donateImage = React.useMemo(() => Math.random() > 0.5 ? DEFAULT_DONATE_IMAGE : SHIGGY_DONATE_IMAGE, []); const donateImage = React.useMemo(() => Math.random() > 0.5 ? DEFAULT_DONATE_IMAGE : SHIGGY_DONATE_IMAGE, []);
const isWindows = navigator.platform.toLowerCase().startsWith("win"); const isWindows = navigator.platform.toLowerCase().startsWith("win");
const isMac = navigator.platform.toLowerCase().startsWith("mac");
const Switches: Array<false | { const Switches: Array<false | {
key: KeysOfType<typeof settings, boolean>; key: KeysOfType<typeof settings, boolean>;
@ -88,6 +89,11 @@ function VencordSettings() {
key: "disableMinSize", key: "disableMinSize",
title: "Disable minimum window size", title: "Disable minimum window size",
note: "Requires a full restart" note: "Requires a full restart"
},
IS_DISCORD_DESKTOP && isMac && {
key: "macosTranslucency",
title: "Enable translucent window",
note: "Requires a full restart"
} }
]; ];

@ -85,6 +85,11 @@ if (!IS_VANILLA) {
options.backgroundColor = "#00000000"; options.backgroundColor = "#00000000";
} }
if (settings.macosTranslucency && process.platform === "darwin") {
options.backgroundColor = "#00000000";
options.vibrancy = "sidebar";
}
process.env.DISCORD_PRELOAD = original; process.env.DISCORD_PRELOAD = original;
super(options); super(options);