[enhancement]: also save fullscreen/maximize

This commit is contained in:
Kendall Garner 2024-04-06 21:14:05 -07:00
parent c0110eff82
commit 6824a5db7a
No known key found for this signature in database
GPG key ID: 18D2767419676C87
3 changed files with 18 additions and 2 deletions

View file

@ -394,6 +394,16 @@ const createWindow = async (first = true) => {
}
if (!first || !startWindowMinimized) {
const maximized = store.get('maximized');
const fullScreen = store.get('fullscreen');
if (maximized) {
mainWindow.maximize();
}
if (fullScreen) {
mainWindow.setFullScreen(true);
}
mainWindow.show();
createWinThumbarButtons();
}
@ -407,7 +417,10 @@ const createWindow = async (first = true) => {
let saved = false;
mainWindow.on('close', (event) => {
store.set('bounds', mainWindow?.getBounds());
store.set('bounds', mainWindow?.getNormalBounds());
store.set('maximized', mainWindow?.isMaximized());
store.set('fullscreen', mainWindow?.isFullScreen());
if (!exitFromTray && store.get('window_exit_to_tray')) {
if (isMacOS() && !forceQuit) {
exitFromTray = true;

View file

@ -64,6 +64,7 @@ const env = {
SERVER_NAME: process.env.SERVER_NAME ?? '',
SERVER_TYPE,
SERVER_URL: process.env.SERVER_URL ?? 'http://',
START_MAXIMIZED: store.get('maximized'),
};
export const localSettings = {

View file

@ -13,6 +13,8 @@ import macMinHover from './assets/min-mac-hover.png';
import macMin from './assets/min-mac.png';
import appIcon from '../../../assets/icons/32x32.png';
const localSettings = isElectron() ? window.electron.localSettings : null;
const WindowsContainer = styled.div`
display: flex;
align-items: center;
@ -228,7 +230,7 @@ export const WindowBar = () => {
: 'Feishin';
document.title = title;
const [max, setMax] = useState(false);
const [max, setMax] = useState(localSettings?.env.START_MAXIMIZED || false);
const handleMinimize = () => minimize();