Skip to content

Commit

Permalink
feat: 初始时根据系统来选择颜色模式
Browse files Browse the repository at this point in the history
  • Loading branch information
awehook committed Mar 18, 2020
1 parent 0afbe52 commit 0f1fa00
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ app.on('activate', () => {
windowMgr.showWelcomeWindow();
}
});

app.setAboutPanelOptions({applicationName: 'BlinkMind(Insider Preview)'});
24 changes: 16 additions & 8 deletions src/main/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from 'debug';
import { app } from 'electron';
import { app, nativeTheme } from 'electron';
import { I18nAvailableLngs, StoreItemKey } from '../common';
const ElectronStore = require('electron-store');
const log = debug('main:store');
Expand All @@ -17,7 +17,6 @@ const store = new ElectronStore({
},
appearance: {
type: 'string',
default: 'light'
}
}
}
Expand All @@ -39,21 +38,20 @@ const store = new ElectronStore({
type: 'string'
},
email: {
type: 'string',
type: 'string'
},
token: {
type: 'string',
type: 'string'
},
status: {
type: 'number',
},

type: 'number'
}
}
}
},
encryptionKey: 'ipcRenderer.send(IpcChannelName.RM_SET_STORE_ITEM',
name: 'blink-mind',
fileExtension: 'log',
fileExtension: 'log'
});

export function setStoreItem(key, value) {
Expand All @@ -75,4 +73,14 @@ export function initStore() {
}
setStoreItem(StoreItemKey.preferences.normal.language, lng);
}
log(
'initStore appearance',
getStoreItem(StoreItemKey.preferences.normal.appearance)
);
if (getStoreItem(StoreItemKey.preferences.normal.appearance) == null) {
setStoreItem(
StoreItemKey.preferences.normal.appearance,
nativeTheme.shouldUseDarkColors ? 'dark' : 'light'
);
}
}

0 comments on commit 0f1fa00

Please sign in to comment.