[bugfix]: default go libsecret, support changing secret store (#493)

* [bugfix]: default go libsecret, support changing secret store

* update readme and rename libsecret
This commit is contained in:
Kendall Garner 2024-02-09 23:20:01 +00:00 committed by GitHub
parent 92478b5ca5
commit 0a658e3a22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 79 additions and 2 deletions

View file

@ -94,7 +94,7 @@ export const ApplicationSettings = () => {
localSettings.fontError(onFontError);
return () => {
ipc!.removeAllListeners('custom-font-error');
ipc?.removeAllListeners('custom-font-error');
};
}

View file

@ -0,0 +1,56 @@
import { SelectItem } from '@mantine/core';
import isElectron from 'is-electron';
import { useTranslation } from 'react-i18next';
import { useSettingsStoreActions, useGeneralSettings } from '../../../../store/settings.store';
import {
SettingsSection,
SettingOption,
} from '/@/renderer/features/settings/components/settings-section';
import { Select } from '/@/renderer/components';
const localSettings = isElectron() ? window.electron.localSettings : null;
const PASSWORD_SETTINGS: SelectItem[] = [
{ label: 'libsecret', value: 'gnome_libsecret' },
{ label: 'KDE 4 (kwallet4)', value: 'kwallet' },
{ label: 'KDE 5 (kwallet5)', value: 'kwallet5' },
{ label: 'KDE 6 (kwallet6)', value: 'kwallet6' },
];
export const PasswordSettings = () => {
const { t } = useTranslation();
const settings = useGeneralSettings();
const { setSettings } = useSettingsStoreActions();
const updateOptions: SettingOption[] = [
{
control: (
<Select
aria-label={t('setting.passwordStore')}
clearable={false}
data={PASSWORD_SETTINGS}
defaultValue={settings.passwordStore ?? 'gnome_libsecret'}
disabled={!isElectron()}
onChange={(e) => {
if (!e) return;
localSettings?.set('password_store', e);
setSettings({
general: {
...settings,
passwordStore: e,
},
});
}}
/>
),
description: t('setting.passwordStore', {
context: 'description',
postProcess: 'sentenceCase',
}),
isHidden: !isElectron(),
title: t('setting.passwordStore', { postProcess: 'sentenceCase' }),
},
];
return <SettingsSection options={updateOptions} />;
};

View file

@ -2,6 +2,10 @@ import { Divider, Stack } from '@mantine/core';
import { UpdateSettings } from '/@/renderer/features/settings/components/window/update-settings';
import { WindowSettings } from '/@/renderer/features/settings/components/window/window-settings';
import { DiscordSettings } from '/@/renderer/features/settings/components/window/discord-settings';
import isElectron from 'is-electron';
import { PasswordSettings } from '/@/renderer/features/settings/components/window/password-settings';
const utils = isElectron() ? window.electron.utils : null;
export const WindowTab = () => {
return (
@ -11,6 +15,12 @@ export const WindowTab = () => {
<DiscordSettings />
<Divider />
<UpdateSettings />
{utils?.isLinux() && (
<>
<Divider />
<PasswordSettings />
</>
)}
</Stack>
);
};