diff --git a/browser/main/modals/PreferencesModal/SnippetTab.js b/browser/main/modals/PreferencesModal/SnippetTab.js index f16bac7b..460d33d6 100644 --- a/browser/main/modals/PreferencesModal/SnippetTab.js +++ b/browser/main/modals/PreferencesModal/SnippetTab.js @@ -8,6 +8,8 @@ import SnippetList from './SnippetList' import eventEmitter from 'browser/main/lib/eventEmitter' import copy from 'copy-to-clipboard' +const path = require('path') + class SnippetTab extends React.Component { constructor (props) { super(props) @@ -17,6 +19,17 @@ class SnippetTab extends React.Component { this.changeDelay = null } + notify (title, options) { + if (global.process.platform === 'win32') { + options.icon = path.join( + 'file://', + global.__dirname, + '../../resources/app.png' + ) + } + return new window.Notification(title, options) + } + handleSnippetNameOrPrefixChange () { clearTimeout(this.changeDelay) this.changeDelay = setTimeout(() => { @@ -56,7 +69,14 @@ class SnippetTab extends React.Component { } handleCopySnippet (e) { + const showCopyNotification = this.props.config.ui.showCopyNotification copy(this.state.currentSnippet.content) + if (showCopyNotification) { + this.notify('Saved to Clipboard!', { + body: 'Paste it wherever you want!', + silent: true + }) + } } render () {