From 7f84fa821af9d1d3ccf0f0fcfd15c87298d072a5 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Tue, 16 Feb 2016 15:31:37 -0500 Subject: [PATCH] The Cmd+ and Cmd- hotkeys zoom in/out the contaier logs. Signed-off-by: Arjun Patel --- src/components/ContainerHome.react.js | 2 +- src/menutemplate.js | 14 ++++++++++++++ src/utils/Util.js | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/ContainerHome.react.js b/src/components/ContainerHome.react.js index dad139c8..dbf5e305 100644 --- a/src/components/ContainerHome.react.js +++ b/src/components/ContainerHome.react.js @@ -102,7 +102,7 @@ var ContainerHome = React.createClass({ } } else { var logWidget = ( - + ); var webWidget; if (this.showWeb()) { diff --git a/src/menutemplate.js b/src/menutemplate.js index c6d3b79b..cc227efc 100644 --- a/src/menutemplate.js +++ b/src/menutemplate.js @@ -135,6 +135,20 @@ var MenuTemplate = function () { label: 'Toggle Chromium Developer Tools', accelerator: 'Alt+' + util.CommandOrCtrl() + '+I', click: function() { remote.getCurrentWindow().toggleDevTools(); } + }, + { + label: 'Log Zoom In', + accelerator: util.CommandOrCtrl() + '+=', + click: function() { + util.adjustLogFontSize(2); + } + }, + { + label: 'Log Zoom Out', + accelerator: util.CommandOrCtrl() + '+-', + click: function() { + util.adjustLogFontSize(-2); + } } ] }, diff --git a/src/utils/Util.js b/src/utils/Util.js index 590e9c27..1d61a21d 100644 --- a/src/utils/Util.js +++ b/src/utils/Util.js @@ -1,3 +1,4 @@ +import $ from 'jquery'; import child_process from 'child_process'; import Promise from 'bluebird'; import fs from 'fs'; @@ -55,6 +56,14 @@ module.exports = { escapePath: function (str) { return str.replace(/ /g, '\\ ').replace(/\(/g, '\\(').replace(/\)/g, '\\)'); }, + getLogFontSize: function() { + return parseInt($('.logs').css('font-size')); + }, + adjustLogFontSize: function(offset) { + var fontSize = this.getLogFontSize(); + var newFontSize = (fontSize + offset) > 0 ? (fontSize + offset) : 1; + $('.logs').css('font-size', newFontSize); + }, home: function () { return app.getPath('home'); },