1
0
mirror of https://github.com/rhysd/Mstdn.git synced 2025-02-02 06:52:13 +01:00

fix setting zoom factor

This commit is contained in:
rhysd 2017-04-20 14:00:57 +09:00
parent 4dbe2b7f08
commit dad67cd8d4
2 changed files with 9 additions and 1 deletions

View File

@ -117,6 +117,7 @@ function startNormalWindow(account: Account, config: Config): Promise<Window> {
defaultWidth: 600, defaultWidth: 600,
defaultHeight: 800, defaultHeight: 800,
}); });
const zoomFactor = config.zoom_factor || 0.9;
const win = new BrowserWindow({ const win = new BrowserWindow({
width: state.width, width: state.width,
height: state.height, height: state.height,
@ -131,6 +132,7 @@ function startNormalWindow(account: Account, config: Config): Promise<Window> {
sandbox: !!config.chromium_sandbox, sandbox: !!config.chromium_sandbox,
preload: PRELOAD_JS, preload: PRELOAD_JS,
partition: partitionForAccount(account), partition: partitionForAccount(account),
zoomFactor,
}, },
}); });
win.once('ready-to-show', () => { win.once('ready-to-show', () => {
@ -149,6 +151,7 @@ function startNormalWindow(account: Account, config: Config): Promise<Window> {
win.webContents.on('dom-ready', () => { win.webContents.on('dom-ready', () => {
applyUserCss(win, config); applyUserCss(win, config);
win.webContents.setZoomFactor(zoomFactor);
log.debug('Send config to renderer procress'); log.debug('Send config to renderer procress');
win.webContents.send('mstdn:config', config, account); win.webContents.send('mstdn:config', config, account);
}); });
@ -167,10 +170,11 @@ function startMenuBar(account: Account, config: Config, bar: Menubar.MenubarApp
log.debug('Setup a menubar window'); log.debug('Setup a menubar window');
return new Promise<Window>(resolve => { return new Promise<Window>(resolve => {
const state = windowState({ const state = windowState({
defaultWidth: 350, defaultWidth: 320,
defaultHeight: 420, defaultHeight: 420,
}); });
const icon = trayIcon(config.icon_color); const icon = trayIcon(config.icon_color);
const zoomFactor = config.zoom_factor || 0.9;
const mb = bar || menubar({ const mb = bar || menubar({
icon, icon,
width: state.width, width: state.width,
@ -186,6 +190,7 @@ function startMenuBar(account: Account, config: Config, bar: Menubar.MenubarApp
sandbox: !!config.chromium_sandbox, sandbox: !!config.chromium_sandbox,
preload: PRELOAD_JS, preload: PRELOAD_JS,
partition: partitionForAccount(account), partition: partitionForAccount(account),
zoomFactor,
}, },
}); });
mb.once('after-create-window', () => { mb.once('after-create-window', () => {
@ -195,6 +200,7 @@ function startMenuBar(account: Account, config: Config, bar: Menubar.MenubarApp
} }
mb.window.webContents.on('dom-ready', () => { mb.window.webContents.on('dom-ready', () => {
applyUserCss(mb.window, config); applyUserCss(mb.window, config);
mb.window.webContents.setZoomFactor(zoomFactor);
log.debug('Send config to renderer procress'); log.debug('Send config to renderer procress');
mb.window.webContents.send('mstdn:config', config, account); mb.window.webContents.send('mstdn:config', config, account);
}); });

View File

@ -44,6 +44,8 @@ function make-dist() {
open dist open dist
} }
export PATH=./node_modules/.bin:$PATH
prepare-app prepare-app
pack-app pack-app
make-dist make-dist