From 282c43ea55e1f6e60af3cedf85839c2e460fb88a Mon Sep 17 00:00:00 2001 From: Arthur Araujo Date: Sat, 16 May 2020 11:54:13 -0300 Subject: [PATCH] Fix #152: adding copy button to about --- main.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 564306a56..a1492bb07 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ /*eslint-disable no-useless-escape*/ -const { app, BrowserWindow, dialog, ipcMain, Menu, net, shell, Tray } = require('electron'); +const { app, BrowserWindow, clipboard, dialog, ipcMain, Menu, net, shell, Tray } = require('electron'); const path = require('path'); const Store = require('electron-store'); const isOnline = require('is-online'); @@ -375,8 +375,15 @@ function createWindow() { message: 'Time to Leave', type: 'info', icon: iconpath, - detail: `\n${detail}` - }); + detail: `\n${detail}`, + buttons: ['Copy', 'OK'], + noLink: true + }).then((result) => { + const buttonId = result.response; + if (buttonId === 0) { + clipboard.writeText(detail); + } + }); } } ]