allow disabling remember window position

closes #2240
pull/2263/head
Mikael Finstad 11 months ago
parent 0114faf2d1
commit 19a39fd1be
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -150,6 +150,7 @@ const defaults: Config = {
outputFileNameMinZeroPadding: 1,
cutFromAdjustmentFrames: 0,
invertTimelineScroll: undefined,
storeWindowBounds: true,
};
const configFileName = 'config.json'; // note: this is also hard-coded inside electron-store

@ -189,7 +189,7 @@ function createWindow() {
});
const debouncedSaveWindowState = debounce(() => {
if (!mainWindow) return;
if (!mainWindow || !configStore.get('storeWindowBounds')) return;
const { x, y, width, height } = mainWindow.getNormalBounds();
configStore.set('windowBounds', { x, y, width, height });
}, 500);

@ -73,7 +73,7 @@ function Settings({
const { t } = useTranslation();
const [showAdvanced, setShowAdvanced] = useState(!simpleMode);
const { customOutDir, changeOutDir, keyframeCut, toggleKeyframeCut, timecodeFormat, setTimecodeFormat, invertCutSegments, setInvertCutSegments, askBeforeClose, setAskBeforeClose, enableAskForImportChapters, setEnableAskForImportChapters, enableAskForFileOpenAction, setEnableAskForFileOpenAction, autoSaveProjectFile, setAutoSaveProjectFile, invertTimelineScroll, setInvertTimelineScroll, language, setLanguage, hideNotifications, setHideNotifications, hideOsNotifications, setHideOsNotifications, autoLoadTimecode, setAutoLoadTimecode, enableAutoHtml5ify, setEnableAutoHtml5ify, customFfPath, setCustomFfPath, storeProjectInWorkingDir, mouseWheelZoomModifierKey, setMouseWheelZoomModifierKey, mouseWheelFrameSeekModifierKey, setMouseWheelFrameSeekModifierKey, mouseWheelKeyframeSeekModifierKey, setMouseWheelKeyframeSeekModifierKey, captureFrameMethod, setCaptureFrameMethod, captureFrameQuality, setCaptureFrameQuality, captureFrameFileNameFormat, setCaptureFrameFileNameFormat, enableNativeHevc, setEnableNativeHevc, enableUpdateCheck, setEnableUpdateCheck, allowMultipleInstances, setAllowMultipleInstances, preferStrongColors, setPreferStrongColors, treatInputFileModifiedTimeAsStart, setTreatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart, setTreatOutputFileModifiedTimeAsStart, exportConfirmEnabled, toggleExportConfirmEnabled } = useUserSettings();
const { customOutDir, changeOutDir, keyframeCut, toggleKeyframeCut, timecodeFormat, setTimecodeFormat, invertCutSegments, setInvertCutSegments, askBeforeClose, setAskBeforeClose, enableAskForImportChapters, setEnableAskForImportChapters, enableAskForFileOpenAction, setEnableAskForFileOpenAction, autoSaveProjectFile, setAutoSaveProjectFile, invertTimelineScroll, setInvertTimelineScroll, language, setLanguage, hideNotifications, setHideNotifications, hideOsNotifications, setHideOsNotifications, autoLoadTimecode, setAutoLoadTimecode, enableAutoHtml5ify, setEnableAutoHtml5ify, customFfPath, setCustomFfPath, storeProjectInWorkingDir, mouseWheelZoomModifierKey, setMouseWheelZoomModifierKey, mouseWheelFrameSeekModifierKey, setMouseWheelFrameSeekModifierKey, mouseWheelKeyframeSeekModifierKey, setMouseWheelKeyframeSeekModifierKey, captureFrameMethod, setCaptureFrameMethod, captureFrameQuality, setCaptureFrameQuality, captureFrameFileNameFormat, setCaptureFrameFileNameFormat, enableNativeHevc, setEnableNativeHevc, enableUpdateCheck, setEnableUpdateCheck, allowMultipleInstances, setAllowMultipleInstances, preferStrongColors, setPreferStrongColors, treatInputFileModifiedTimeAsStart, setTreatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart, setTreatOutputFileModifiedTimeAsStart, exportConfirmEnabled, toggleExportConfirmEnabled, storeWindowBounds, setStoreWindowBounds } = useUserSettings();
const onLangChange = useCallback<ChangeEventHandler<HTMLSelectElement>>((e) => {
const { value } = e.target;
@ -425,6 +425,15 @@ function Settings({
<Header title={t('User interface')} />
{showAdvanced && (
<Row>
<KeyCell>{t('Remember window size and position')}</KeyCell>
<td>
<Switch checked={storeWindowBounds} onCheckedChange={setStoreWindowBounds} />
</td>
</Row>
)}
{showAdvanced && (
<Row>
<KeyCell>{t('Auto load timecode from file as an offset in the timeline?')}</KeyCell>

@ -163,6 +163,8 @@ export default () => {
useEffect(() => safeSetConfig({ outputFileNameMinZeroPadding }), [outputFileNameMinZeroPadding]);
const [cutFromAdjustmentFrames, setCutFromAdjustmentFrames] = useState(safeGetConfigInitial('cutFromAdjustmentFrames'));
useEffect(() => safeSetConfig({ cutFromAdjustmentFrames }), [cutFromAdjustmentFrames]);
const [storeWindowBounds, setStoreWindowBounds] = useState(safeGetConfigInitial('storeWindowBounds'));
useEffect(() => safeSetConfig({ storeWindowBounds }), [storeWindowBounds]);
const resetKeyBindings = useCallback(() => {
configStore.reset('keyBindings');
@ -299,5 +301,7 @@ export default () => {
setOutputFileNameMinZeroPadding,
cutFromAdjustmentFrames,
setCutFromAdjustmentFrames,
storeWindowBounds,
setStoreWindowBounds,
};
};

@ -89,6 +89,7 @@ export interface Config {
outFormatLocked: string | undefined,
safeOutputFileName: boolean,
windowBounds: { x: number, y: number, width: number, height: number } | undefined,
storeWindowBounds: boolean,
enableAutoHtml5ify: boolean,
keyBindings: KeyBinding[],
customFfPath: string | undefined,

Loading…
Cancel
Save