Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling the hidden preferences window. #2269

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions source/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ ipc.answerMain('archive-conversation', async () => {

async function openHiddenPreferences(): Promise<boolean> {
if (!isPreferencesOpen()) {
document.documentElement.classList.add('hide-preferences-window');
const disableSettingsHiding = await ipc.callMain<undefined, boolean>('get-config-disableSettingsHiding');
if (!disableSettingsHiding) {
document.documentElement.classList.add('hide-preferences-window');
}

await openPreferences();

Expand Down Expand Up @@ -675,7 +678,10 @@ async function closePreferences(): Promise<void> {
// Get the parent of preferences, that's not getting deleted
const preferencesParent = preferencesOverlay.closest('div:not([class])')!;

preferencesOverlayObserver.observe(preferencesParent, {childList: true});
const disableSettingsHiding = await ipc.callMain<undefined, boolean>('get-config-disableSettingsHiding');
if (!disableSettingsHiding) {
preferencesOverlayObserver.observe(preferencesParent, {childList: true});
}

const closeButton = preferencesOverlay.querySelector(selectors.closePreferencesButton)!;
(closeButton as HTMLElement)?.click();
Expand Down
5 changes: 5 additions & 0 deletions source/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export type StoreType = {
autoplayVideos: boolean;
isSpellCheckerEnabled: boolean;
spellCheckerLanguages: string[];
disableSettingsHiding: boolean;
};

const schema: Store.Schema<StoreType> = {
Expand Down Expand Up @@ -218,6 +219,10 @@ const schema: Store.Schema<StoreType> = {
},
default: [],
},
disableSettingsHiding: {
type: 'boolean',
default: false,
},
};

function updateVibrancySetting(store: Store<StoreType>): void {
Expand Down
1 change: 1 addition & 0 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,4 @@ ipc.answerRenderer<undefined, StoreType['emojiStyle']>('get-config-emojiStyle',
ipc.answerRenderer<StoreType['emojiStyle'], void>('set-config-emojiStyle', async emojiStyle => {
config.set('emojiStyle', emojiStyle);
});
ipc.answerRenderer<undefined, StoreType['disableSettingsHiding']>('get-config-disableSettingsHiding', async () => config.get('disableSettingsHiding'));
8 changes: 8 additions & 0 deletions source/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ Press Command/Ctrl+R in Caprine to see your changes.
shell.openPath(filePath);
},
},
{
label: 'Disable Settings Hiding',
type: 'checkbox',
checked: config.get('disableSettingsHiding'),
click() {
config.set('disableSettingsHiding', !config.get('disableSettingsHiding'));
},
},
];

const preferencesSubmenu: MenuItemConstructorOptions[] = [
Expand Down
Loading