Merge pull request #209 from jeffvli/fix/#202

Add frame to macOS native window bar
This commit is contained in:
Kendall Garner 2024-01-23 05:07:10 +00:00 committed by GitHub
commit 61ecd3253e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 41 additions and 4 deletions

View file

@ -7,8 +7,11 @@ import {
import { THEME_DATA } from '/@/renderer/hooks';
import { useGeneralSettings, useSettingsStoreActions } from '/@/renderer/store/settings.store';
import { AppTheme } from '/@/renderer/themes/types';
import isElectron from 'is-electron';
import { useTranslation } from 'react-i18next';
const localSettings = isElectron() ? window.electron.localSettings : null;
export const ThemeSettings = () => {
const { t } = useTranslation();
const settings = useGeneralSettings();
@ -26,6 +29,15 @@ export const ThemeSettings = () => {
followSystemTheme: e.currentTarget.checked,
},
});
if (localSettings) {
localSettings.themeSet(
e.currentTarget.checked
? 'system'
: settings.theme === AppTheme.DEFAULT_DARK
? 'dark'
: 'light',
);
}
}}
/>
),
@ -42,12 +54,18 @@ export const ThemeSettings = () => {
data={THEME_DATA}
defaultValue={settings.theme}
onChange={(e) => {
const theme = e as AppTheme;
setSettings({
general: {
...settings,
theme: e as AppTheme,
theme,
},
});
if (localSettings) {
localSettings.themeSet(
theme === AppTheme.DEFAULT_DARK ? 'dark' : 'light',
);
}
}}
/>
),