added transparency option

and changed the customTitleBar check to only be used on windows
(according to electron spec)
This commit is contained in:
miri 2024-01-18 17:33:36 +01:00
parent b20c77734c
commit e764c51e77
2 changed files with 19 additions and 2 deletions

View file

@ -370,6 +370,7 @@ function createMainWindow() {
const { frameless } = VencordSettings.store; const { frameless } = VencordSettings.store;
const noFrame = frameless === true || customTitleBar === true; const noFrame = frameless === true || customTitleBar === true;
const isWindows = process.platform === "win32";
const win = (mainWin = new BrowserWindow({ const win = (mainWin = new BrowserWindow({
show: false, show: false,
@ -388,8 +389,8 @@ function createMainWindow() {
backgroundColor: "#00000000", backgroundColor: "#00000000",
backgroundMaterial: transparencyOption backgroundMaterial: transparencyOption
}), }),
// Fix transparencyOption for custom discord titlebar // Fix transparencyOption for custom discord titlebar on Windows
...(customTitleBar && ...((customTitleBar || !isWindows) &&
transparencyOption && transparencyOption &&
transparencyOption !== "none" && { transparencyOption !== "none" && {
transparent: true transparent: true

View file

@ -16,6 +16,7 @@ import { isTruthy } from "shared/utils/guards";
export default function SettingsUi() { export default function SettingsUi() {
const Settings = useSettings(); const Settings = useSettings();
const supportsWindowsTransparency = VesktopNative.app.supportsWindowsTransparency(); const supportsWindowsTransparency = VesktopNative.app.supportsWindowsTransparency();
const isWindows = process.platform === "win32";
const { autostart } = VesktopNative; const { autostart } = VesktopNative;
const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled()); const [autoStartEnabled, setAutoStartEnabled] = useState(autostart.isEnabled());
@ -100,6 +101,21 @@ export default function SettingsUi() {
Notification Badge Notification Badge
</Switch> </Switch>
{!isWindows && (
<>
<Switch
value={Settings.transparencyOption!="none"}
onChange={v => {
//just set it to a random value that isn't none to keep consistency with Windows
Settings.transparencyOption=v ? "acrylic":"none";
}}
note="Requires a full restart. You will need a theme that supports transparency for this to work."
>
Transparency
</Switch>
</>
)}
{switches.map(([key, text, note, def, predicate]) => ( {switches.map(([key, text, note, def, predicate]) => (
<Switch <Switch
value={(Settings[key as any] ?? def ?? false) && predicate?.() !== false} value={(Settings[key as any] ?? def ?? false) && predicate?.() !== false}