fix: hideMenubar preference not working

fixes #448
This commit is contained in:
lin onetwo 2023-12-30 13:25:40 +08:00
parent 80510ce5e9
commit eff4cd5a2a
2 changed files with 8 additions and 4 deletions

View file

@ -10,6 +10,7 @@ import { Languages } from '../Preferences/sections/Languages';
import { TiddlyWiki } from '../Preferences/sections/TiddlyWiki';
import { NewUserMessage } from './NewUserMessage';
import { useAutoCreateFirstWorkspace } from './useAutoCreateFirstWorkspace';
import { useRestartSnackbar } from '@/components/RestartSnackbar';
const InnerContentRoot = styled.div`
flex: 1;
@ -27,6 +28,7 @@ export function Guide(): JSX.Element {
const [wikiCreationMessage, wikiCreationMessageSetter] = useState('');
useAutoCreateFirstWorkspace(workspacesList, wikiCreationMessageSetter);
const preferences = usePreferenceObservable();
const [requestRestartCountDown, RestartSnackbar] = useRestartSnackbar();
return (
<>
<InnerContentRoot>
@ -36,7 +38,8 @@ export function Guide(): JSX.Element {
)}
</InnerContentRoot>
<Languages languageSelectorOnly />
<TiddlyWiki />
<TiddlyWiki requestRestartCountDown={requestRestartCountDown} />
{RestartSnackbar}
</>
);
}

View file

@ -135,6 +135,7 @@ export class Window implements IWindowService {
}
// create new window
const { hideMenuBar: autoHideMenuBar, titleBar: showTitleBar, menuBarAlwaysOnTop, alwaysOnTop } = await this.preferenceService.getPreferences();
let windowWithBrowserViewConfig: Partial<BrowserWindowConstructorOptions> = {};
let windowWithBrowserViewState: windowStateKeeperState | undefined;
const WindowToKeepPositionState = [WindowNames.main, WindowNames.menuBar];
@ -161,10 +162,10 @@ export class Window implements IWindowService {
maximizable: true,
minimizable: true,
fullscreenable: true,
autoHideMenuBar: false,
autoHideMenuBar,
// hide titleBar should not take effect on setting window
titleBarStyle: ![WindowNames.main, WindowNames.menuBar].includes(windowName) || (await this.preferenceService.get('titleBar')) ? 'default' : 'hidden',
alwaysOnTop: windowName === WindowNames.menuBar ? await this.preferenceService.get('menuBarAlwaysOnTop') : await this.preferenceService.get('alwaysOnTop'),
titleBarStyle: (![WindowNames.main, WindowNames.menuBar].includes(windowName) || showTitleBar) ? 'default' : 'hidden',
alwaysOnTop: windowName === WindowNames.menuBar ? menuBarAlwaysOnTop : alwaysOnTop,
webPreferences: {
devTools: !isTest,
nodeIntegration: false,