Add a setting for the quit confirmation dialog (#2901)

This commit is contained in:
Isaac Wismer
2025-06-18 14:13:12 -04:00
committed by GitHub
parent 6bf14aa74f
commit e854725202
4 changed files with 64 additions and 0 deletions
@@ -13,6 +13,7 @@ interface AppSettingsSectionProps {
export default function AppSettingsSection({ scrollToSection }: AppSettingsSectionProps) {
const [menuBarIconEnabled, setMenuBarIconEnabled] = useState(true);
const [dockIconEnabled, setDockIconEnabled] = useState(true);
const [quitConfirmationEnabled, setQuitConfirmationEnabled] = useState(true);
const [isMacOS, setIsMacOS] = useState(false);
const [isDockSwitchDisabled, setIsDockSwitchDisabled] = useState(false);
const [showNotificationModal, setShowNotificationModal] = useState(false);
@@ -39,6 +40,10 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
setMenuBarIconEnabled(enabled);
});
window.electron.getQuitConfirmationState().then((enabled) => {
setQuitConfirmationEnabled(enabled);
});
if (isMacOS) {
window.electron.getDockIconState().then((enabled) => {
setDockIconEnabled(enabled);
@@ -86,6 +91,14 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
}
};
const handleQuitConfirmationToggle = async () => {
const newState = !quitConfirmationEnabled;
const success = await window.electron.setQuitConfirmation(newState);
if (success) {
setQuitConfirmationEnabled(newState);
}
};
return (
<section id="appSettings" className="px-8">
<div className="flex justify-between items-center mb-2">
@@ -159,6 +172,22 @@ export default function AppSettingsSection({ scrollToSection }: AppSettingsSecti
</div>
</div>
)}
<div className="flex items-center justify-between mb-4">
<div>
<h3 className="text-textStandard">Quit Confirmation</h3>
<p className="text-xs text-textSubtle max-w-md mt-[2px]">
Show confirmation dialog when quitting the app
</p>
</div>
<div className="flex items-center">
<Switch
checked={quitConfirmationEnabled}
onCheckedChange={handleQuitConfirmationToggle}
variant="mono"
/>
</div>
</div>
</div>
{/* Help & Feedback Section */}