From 9ab876f6c60af264129acd9985e632458006e76e Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki Date: Fri, 24 Apr 2020 19:58:38 +0900 Subject: [PATCH] recover OS notification --- lib/package/config.coffee | 10 ++++++++-- lib/ui/notifications.coffee | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/lib/package/config.coffee b/lib/package/config.coffee index 7c1ab069..ceafd0ad 100644 --- a/lib/package/config.coffee +++ b/lib/package/config.coffee @@ -152,12 +152,12 @@ config = {value:'block', description:'Display results under code'} {value:'console', description:'Display results in the REPL'} ] - order: 1 + order: 0 scrollToResult: title: 'Scroll to Inline Results' type: 'boolean' default: false - order: 2 + order: 1 docsDisplayMode: title: 'Documentation Display Mode' type: 'string' @@ -166,6 +166,12 @@ config = {value: 'inline', description: 'Show documentation in the editor'} {value: 'pane', description: 'Show documentation in the documentation pane'} ] + order: 2 + notifications: + title: 'Notifications' + type: 'boolean' + default: true + description: 'Enable notifications for evaluation.' order: 3 errorNotifications: title: 'Error Notifications' diff --git a/lib/ui/notifications.coffee b/lib/ui/notifications.coffee index 78dc11ac..27fcafb7 100644 --- a/lib/ui/notifications.coffee +++ b/lib/ui/notifications.coffee @@ -1,24 +1,24 @@ remote = require 'remote' module.exports = - # notes: [] - # window: remote.getCurrentWindow() + notes: [] + window: remote.getCurrentWindow() activate: -> - # document.addEventListener 'focusin', => - # @clear() + document.addEventListener 'focusin', => + @clear() enabled: -> atom.config.get('julia-client.uiOptions.notifications') show: (msg, force) -> - # return unless force or (@enabled() and not document.hasFocus()) - # n = new Notification "Julia Client", - # body: msg - # n.onclick = => - # @window.focus() - # @notes.push(n) + return unless force or (@enabled() and not document.hasFocus()) + n = new Notification "Julia Client", + body: msg + n.onclick = => + @window.focus() + @notes.push(n) - # clear: -> - # for note in @notes - # note.close() - # @notes = [] + clear: -> + for note in @notes + note.close() + @notes = []