feat: optimize electron macos header style (#1774)

Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
Peng Xiao
2023-04-03 03:01:22 +08:00
committed by GitHub
parent fa150a93a0
commit e0eecffb2f
31 changed files with 635 additions and 169 deletions

View File

@@ -2,7 +2,7 @@ import * as os from 'node:os';
import path from 'node:path';
import { Storage } from '@affine/octobase-node';
import { ipcMain } from 'electron';
import { BrowserWindow, ipcMain, nativeTheme } from 'electron';
import fs from 'fs-extra';
const AFFINE_ROOT = path.join(os.homedir(), '.affine');
@@ -15,7 +15,20 @@ export const appState = {
};
export const registerHandlers = () => {
ipcMain.handle('workspaceSync', async (_, id) => {
ipcMain.handle('octo:workspace-sync', async (_, id) => {
return appState.storage.sync(id, '');
});
ipcMain.handle('ui:theme-change', async (_, theme) => {
nativeTheme.themeSource = theme;
});
ipcMain.handle('ui:sidebar-visibility-change', async (_, visible) => {
// todo
const windows = BrowserWindow.getAllWindows();
windows.forEach(w => {
// hide window buttons when sidebar is not visible
w.setWindowButtonVisibility(visible);
});
});
};