diff --git a/app/menus/menu.js b/app/menus/menu.js index bc6cce38fec0..231afdc6e9e4 100644 --- a/app/menus/menu.js +++ b/app/menus/menu.js @@ -13,6 +13,7 @@ const helpMenu = require('./menus/help'); const darwinMenu = require('./menus/darwin'); const {getDecoratedKeymaps} = require('../plugins'); const {execCommand} = require('../commands'); +const {getRendererTypes} = require('../utils/renderer-utils'); const appName = app.getName(); const appVersion = app.getVersion(); @@ -39,10 +40,18 @@ exports.createMenu = (createWindow, getLoadedPluginVersions) => { const pluginList = loadedPlugins.length === 0 ? 'none' : loadedPlugins.map(plugin => `\n ${plugin.name} (${plugin.version})`); + const rendererCounts = Object.values(getRendererTypes()).reduce((acc, type) => { + acc[type] = acc[type] ? acc[type] + 1 : 1; + return acc; + }, {}); + const renderers = Object.entries(rendererCounts) + .map(([type, count]) => type + (count > 1 ? ` (${count})` : '')) + .join(', '); + dialog.showMessageBox({ title: `About ${appName}`, message: `${appName} ${appVersion} (${updateChannel})`, - detail: `Plugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2018 ZEIT, Inc.`, + detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2018 ZEIT, Inc.`, buttons: [], icon }); diff --git a/app/ui/window.js b/app/ui/window.js index e8aca4225a2a..cab683037347 100644 --- a/app/ui/window.js +++ b/app/ui/window.js @@ -13,6 +13,7 @@ const fetchNotifications = require('../notifications'); const Session = require('../session'); const contextMenuTemplate = require('./contextmenu'); const {execCommand} = require('../commands'); +const {setRendererType, unsetRendererType} = require('../utils/renderer-utils'); module.exports = class Window { constructor(options_, cfg, fn) { @@ -153,6 +154,7 @@ module.exports = class Window { session.on('exit', () => { rpc.emit('session exit', {uid: options.uid}); + unsetRendererType(options.uid); sessions.delete(options.uid); }); }); @@ -192,6 +194,10 @@ module.exports = class Window { } } }); + rpc.on('info renderer', ({uid, type}) => { + // Used in the "About" dialog + setRendererType(uid, type); + }); rpc.on('open external', ({url}) => { shell.openExternal(url); }); diff --git a/app/utils/renderer-utils.js b/app/utils/renderer-utils.js new file mode 100644 index 000000000000..7385b484ece5 --- /dev/null +++ b/app/utils/renderer-utils.js @@ -0,0 +1,19 @@ +const rendererTypes = {}; + +function getRendererTypes() { + return rendererTypes; +} + +function setRendererType(uid, type) { + rendererTypes[uid] = type; +} + +function unsetRendererType(uid) { + delete rendererTypes[uid]; +} + +module.exports = { + getRendererTypes, + setRendererType, + unsetRendererType +}; diff --git a/lib/components/term.js b/lib/components/term.js index 3cd5cdf4838c..afd46c22e7dc 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -52,6 +52,8 @@ const getTermOptions = props => { useWebGL = true; } } + Term.reportRenderer(props.uid, useWebGL ? 'WebGL' : 'Canvas'); + return { macOptionIsMeta: props.modifierKeys.altIsMeta, scrollback: props.scrollback, @@ -110,6 +112,16 @@ export default class Term extends React.PureComponent { this.disposableListeners = []; } + // The main process shows this in the About dialog + static reportRenderer(uid, type) { + const rendererTypes = Term.rendererTypes || {}; + if (rendererTypes[uid] !== type) { + rendererTypes[uid] = type; + Term.rendererTypes = rendererTypes; + window.rpc.emit('info renderer', {uid, type}); + } + } + componentDidMount() { const {props} = this;