import ChevronRightIcon from '@mui/icons-material/ChevronRight'; import { Divider, List, ListItemButton, Menu, MenuItem, Switch } from '@mui/material'; import PopupState, { bindMenu, bindTrigger } from 'material-ui-popup-state'; import React from 'react'; import { Trans, useTranslation } from 'react-i18next'; import { ListItem, ListItemText } from '@/components/ListItem'; import { usePromiseValue } from '@/helpers/useServiceValue'; import { usePreferenceObservable } from '@services/preferences/hooks'; import { IPreferences } from '@services/preferences/interface'; import { Paper, SectionTitle } from '../PreferenceComponents'; import type { ISectionProps } from '../useSections'; const getThemeString = (theme: IPreferences['themeSource']): string => { if (theme === 'light') return 'Light'; if (theme === 'dark') return 'Dark'; return 'System default'; }; export function General(props: Required): React.JSX.Element { const { t } = useTranslation(); const preference = usePreferenceObservable(); const platform = usePromiseValue(async () => await window.service.context.get('platform')); return ( <> {t('Preference.General')} {preference === undefined || platform === undefined ? {t('Loading')} : ( <> { await window.service.preference.set('rememberLastPageVisited', event.target.checked); props.requestRestartCountDown(); }} /> } > {(popupState) => ( <> { await window.service.preference.set('themeSource', 'system'); popupState.close(); }} > {t('Preference.SystemDefaultTheme')} { await window.service.preference.set('themeSource', 'light'); popupState.close(); }} > {t('Preference.LightTheme')} { await window.service.preference.set('themeSource', 'dark'); popupState.close(); }} > {t('Preference.DarkTheme')} )} { await window.service.preference.set('sidebar', event.target.checked); await window.service.workspaceView.realignActiveWorkspace(); }} /> } > { await window.service.preference.set('showSideBarIcon', event.target.checked); // when you hide icon, show the text if (!event.target.checked && !preference.showSideBarText) { await window.service.preference.set('showSideBarText', true); } }} /> } > { await window.service.preference.set('showSideBarText', event.target.checked); // when you hide text, show the icon if (!event.target.checked && !preference.showSideBarIcon) { await window.service.preference.set('showSideBarIcon', true); } }} /> } > { await window.service.preference.set('titleBar', event.target.checked); // no need to realignActiveWorkspace -> realignActiveView , otherwise view will reload bound, and move down by height of titlebar, while titlebar change is not taking effect yet // await window.service.workspaceView.realignActiveWorkspace(); props.requestRestartCountDown(); }} /> } > {platform !== 'darwin' && ( <> { await window.service.preference.set('hideMenuBar', event.target.checked); props.requestRestartCountDown(); }} /> } > )} { await window.service.preference.set('alwaysOnTop', event.target.checked); props.requestRestartCountDown(); }} /> } > { await window.service.preference.set('runOnBackground', event.target.checked); }} /> } > {platform === 'darwin' && ( <> { await window.service.preference.set('swipeToNavigate', event.target.checked); props.requestRestartCountDown(); }} /> } > Navigate between pages with 3-finger gestures. Swipe left to go back or swipe right to go forward.
To enable it, you also need to change macOS Preferences → TrackPad → More Gestures → Swipe between page to Swipe with three fingers or Swipe with two or three fingers. } />
)} )}
); }