Force disable minimise if tray is hidden
This commit is contained in:
parent
9c75d31895
commit
ff87db66d7
2 changed files with 8 additions and 6 deletions
|
@ -246,7 +246,7 @@ export function createMainWindow() {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
win.on("close", e => {
|
win.on("close", e => {
|
||||||
if (isQuitting || Settings.store.minimizeToTray === false) return;
|
if (isQuitting || Settings.store.minimizeToTray === false || Settings.store.tray === false) return;
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
win.hide();
|
win.hide();
|
||||||
|
@ -255,7 +255,7 @@ export function createMainWindow() {
|
||||||
});
|
});
|
||||||
|
|
||||||
initWindowBoundsListeners(win);
|
initWindowBoundsListeners(win);
|
||||||
if (Settings.tray !== false) initTray(win);
|
if (Settings.store.tray ?? true) initTray(win);
|
||||||
initMenuBar(win);
|
initMenuBar(win);
|
||||||
makeLinksOpenExternally(win);
|
makeLinksOpenExternally(win);
|
||||||
initSettingsListeners(win);
|
initSettingsListeners(win);
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default function SettingsUi() {
|
||||||
Button
|
Button
|
||||||
} = Common;
|
} = Common;
|
||||||
|
|
||||||
const switches: [keyof typeof Settings, string, string, boolean?][] = [
|
const switches: [keyof typeof Settings, string, string, boolean?, (() => boolean)?][] = [
|
||||||
[
|
[
|
||||||
"tray",
|
"tray",
|
||||||
"Use tray",
|
"Use tray",
|
||||||
|
@ -32,7 +32,8 @@ export default function SettingsUi() {
|
||||||
"minimizeToTray",
|
"minimizeToTray",
|
||||||
"Minimize to tray",
|
"Minimize to tray",
|
||||||
"Hitting X will make Vencord Desktop minimize to the tray instead of closing",
|
"Hitting X will make Vencord Desktop minimize to the tray instead of closing",
|
||||||
true
|
true,
|
||||||
|
() => Settings["tray"] ?? true
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"disableMinSize",
|
"disableMinSize",
|
||||||
|
@ -68,9 +69,10 @@ export default function SettingsUi() {
|
||||||
|
|
||||||
<FormDivider className={Margins.top16 + " " + Margins.bottom16} />
|
<FormDivider className={Margins.top16 + " " + Margins.bottom16} />
|
||||||
|
|
||||||
{switches.map(([key, text, note, def]) => (
|
{switches.map(([key, text, note, def, predicate]) => (
|
||||||
<FormSwitch
|
<FormSwitch
|
||||||
value={Settings[key] ?? def ?? false}
|
value={(Settings[key] ?? def ?? false) && (!predicate || predicate())}
|
||||||
|
disabled={predicate && !predicate()}
|
||||||
onChange={v => (Settings[key] = v)}
|
onChange={v => (Settings[key] = v)}
|
||||||
note={note}
|
note={note}
|
||||||
key={key}
|
key={key}
|
||||||
|
|
Reference in a new issue