[enhancement]: also save fullscreen/maximize
This commit is contained in:
parent
c0110eff82
commit
6824a5db7a
3 changed files with 18 additions and 2 deletions
|
@ -394,6 +394,16 @@ const createWindow = async (first = true) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!first || !startWindowMinimized) {
|
if (!first || !startWindowMinimized) {
|
||||||
|
const maximized = store.get('maximized');
|
||||||
|
const fullScreen = store.get('fullscreen');
|
||||||
|
|
||||||
|
if (maximized) {
|
||||||
|
mainWindow.maximize();
|
||||||
|
}
|
||||||
|
if (fullScreen) {
|
||||||
|
mainWindow.setFullScreen(true);
|
||||||
|
}
|
||||||
|
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
createWinThumbarButtons();
|
createWinThumbarButtons();
|
||||||
}
|
}
|
||||||
|
@ -407,7 +417,10 @@ const createWindow = async (first = true) => {
|
||||||
let saved = false;
|
let saved = false;
|
||||||
|
|
||||||
mainWindow.on('close', (event) => {
|
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 (!exitFromTray && store.get('window_exit_to_tray')) {
|
||||||
if (isMacOS() && !forceQuit) {
|
if (isMacOS() && !forceQuit) {
|
||||||
exitFromTray = true;
|
exitFromTray = true;
|
||||||
|
|
|
@ -64,6 +64,7 @@ const env = {
|
||||||
SERVER_NAME: process.env.SERVER_NAME ?? '',
|
SERVER_NAME: process.env.SERVER_NAME ?? '',
|
||||||
SERVER_TYPE,
|
SERVER_TYPE,
|
||||||
SERVER_URL: process.env.SERVER_URL ?? 'http://',
|
SERVER_URL: process.env.SERVER_URL ?? 'http://',
|
||||||
|
START_MAXIMIZED: store.get('maximized'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const localSettings = {
|
export const localSettings = {
|
||||||
|
|
|
@ -13,6 +13,8 @@ import macMinHover from './assets/min-mac-hover.png';
|
||||||
import macMin from './assets/min-mac.png';
|
import macMin from './assets/min-mac.png';
|
||||||
import appIcon from '../../../assets/icons/32x32.png';
|
import appIcon from '../../../assets/icons/32x32.png';
|
||||||
|
|
||||||
|
const localSettings = isElectron() ? window.electron.localSettings : null;
|
||||||
|
|
||||||
const WindowsContainer = styled.div`
|
const WindowsContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -228,7 +230,7 @@ export const WindowBar = () => {
|
||||||
: 'Feishin';
|
: 'Feishin';
|
||||||
document.title = title;
|
document.title = title;
|
||||||
|
|
||||||
const [max, setMax] = useState(false);
|
const [max, setMax] = useState(localSettings?.env.START_MAXIMIZED || false);
|
||||||
|
|
||||||
const handleMinimize = () => minimize();
|
const handleMinimize = () => minimize();
|
||||||
|
|
||||||
|
|
Reference in a new issue