From c71e9cf618b92e4e966f5c04a00c1889fedd1de2 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Mon, 21 Oct 2013 17:19:41 -0700 Subject: [PATCH 01/13] Add flashError css --- static/utilities.less | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/static/utilities.less b/static/utilities.less index 74b0bc030..0a0183ce6 100644 --- a/static/utilities.less +++ b/static/utilities.less @@ -60,3 +60,13 @@ div > .inline-block-tight:last-child { margin-left: 0; } } + +.error { + -webkit-animation: flash-error 0.3s ease-in; +} + +@-webkit-keyframes flash-error { + 0% { background: @background-color-error; } + + 100% { background: auto; } +} From 3c08ae2de60f7c2b49f72e1b42ec719274373761 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 22 Oct 2013 12:18:22 -0700 Subject: [PATCH 02/13] Add Atom::visualBeep method --- src/atom.coffee | 6 ++++++ static/utilities.less | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/atom.coffee b/src/atom.coffee index 0b6d3896f..2c0b904e6 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -11,6 +11,7 @@ Package = require './package' ipc = require 'ipc' remote = require 'remote' shell = require 'shell' +{$$} = require 'space-pen' crypto = require 'crypto' path = require 'path' dialog = remote.require 'dialog' @@ -303,6 +304,11 @@ class Atom try require userInitScriptPath if fsUtils.isFileSync(userInitScriptPath) catch error + visualBeep: -> + overlay = $$ -> @div class: 'visual-beep' + $('body').append overlay + setTimeout((-> overlay.remove()), 1000) + console.error "Failed to load `#{userInitScriptPath}`", error.stack, error requireWithGlobals: (id, globals={}) -> diff --git a/static/utilities.less b/static/utilities.less index 0a0183ce6..824d3dafc 100644 --- a/static/utilities.less +++ b/static/utilities.less @@ -61,6 +61,23 @@ div > .inline-block-tight:last-child { } } +.visual-beep { + z-index: 1000; + width: 100%; + height: 100%; + position: fixed; + top: 0px; + right: 0px; + opacity: 0.0; + -webkit-animation: visual-beep-flash 0.2s ease-out; + background: @background-color-warning; +} + +@-webkit-keyframes visual-beep-flash { + 0% { opacity: 0.5 } + 100% {opacity: 0.0 } +} + .error { -webkit-animation: flash-error 0.3s ease-in; } From 069ae17f9d5c16b259404f3fe5517965837808e2 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 22 Oct 2013 12:32:06 -0700 Subject: [PATCH 03/13] Atom::beep triggers visual and audio beep --- src/atom.coffee | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 2c0b904e6..35bd13dba 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -297,18 +297,22 @@ class Atom process.crash() beep: -> + @audioBeep() + @visualBeep() + + audioBeep: -> shell.beep() + visualBeep: -> + overlay = $$ -> @div class: 'visual-beep' + $('body').append overlay + setTimeout((-> overlay.remove()), 1000) + requireUserInitScript: -> userInitScriptPath = path.join(@config.configDirPath, "user.coffee") try require userInitScriptPath if fsUtils.isFileSync(userInitScriptPath) catch error - visualBeep: -> - overlay = $$ -> @div class: 'visual-beep' - $('body').append overlay - setTimeout((-> overlay.remove()), 1000) - console.error "Failed to load `#{userInitScriptPath}`", error.stack, error requireWithGlobals: (id, globals={}) -> From 71ede6b97f5a211d7ebb48c99b6479577fea2539 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 22 Oct 2013 12:43:41 -0700 Subject: [PATCH 04/13] Add core.audioBeep and core.visualBeep to core settings Closes #996 --- src/atom.coffee | 6 +++--- src/root-view.coffee | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 35bd13dba..43162aaf6 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -297,8 +297,8 @@ class Atom process.crash() beep: -> - @audioBeep() - @visualBeep() + @audioBeep() if @config.get('core.audioBeep') + @visualBeep() if @config.get('core.visualBeep') audioBeep: -> shell.beep() @@ -306,7 +306,7 @@ class Atom visualBeep: -> overlay = $$ -> @div class: 'visual-beep' $('body').append overlay - setTimeout((-> overlay.remove()), 1000) + setTimeout((-> overlay.remove()), 300) requireUserInitScript: -> userInitScriptPath = path.join(@config.configDirPath, "user.coffee") diff --git a/src/root-view.coffee b/src/root-view.coffee index 033fa3f39..57086ae15 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -50,6 +50,8 @@ class RootView extends View disabledPackages: [] themes: ['atom-dark-ui', 'atom-dark-syntax'] projectHome: path.join(atom.getHomeDirPath(), 'github') + audioBeep: true + visualBeep: false @acceptsDocuments: true From d38067ec1aa3fd637525eb7f8e2fe69503388a32 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 22 Oct 2013 13:00:14 -0700 Subject: [PATCH 05/13] Fix lint errors --- static/utilities.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/utilities.less b/static/utilities.less index 824d3dafc..ae7ef14aa 100644 --- a/static/utilities.less +++ b/static/utilities.less @@ -66,8 +66,8 @@ div > .inline-block-tight:last-child { width: 100%; height: 100%; position: fixed; - top: 0px; - right: 0px; + top: 0; + right: 0; opacity: 0.0; -webkit-animation: visual-beep-flash 0.2s ease-out; background: @background-color-warning; From ffcd9483621c71ccd99ed4a94d6ff82ae1a36cd3 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 10:41:21 -0700 Subject: [PATCH 06/13] Move beep method to rootView --- src/atom.coffee | 11 +---------- src/root-view.coffee | 7 ++++++- static/utilities.less | 17 ----------------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 55e3f5b03..6db82faab 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -304,16 +304,7 @@ class Atom process.crash() beep: -> - @audioBeep() if @config.get('core.audioBeep') - @visualBeep() if @config.get('core.visualBeep') - - audioBeep: -> - shell.beep() - - visualBeep: -> - overlay = $$ -> @div class: 'visual-beep' - $('body').append overlay - setTimeout((-> overlay.remove()), 300) + @rootView.beep() requireUserInitScript: -> userInitScriptPath = path.join(@config.configDirPath, "user.coffee") diff --git a/src/root-view.coffee b/src/root-view.coffee index 57086ae15..a05639233 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -2,6 +2,7 @@ fs = require 'fs' ipc = require 'ipc' path = require 'path' Q = require 'q' +shell = require 'shell' {$, $$, View} = require './space-pen-extensions' fsUtils = require './fs-utils' _ = require 'underscore-plus' @@ -51,7 +52,6 @@ class RootView extends View themes: ['atom-dark-ui', 'atom-dark-syntax'] projectHome: path.join(atom.getHomeDirPath(), 'github') audioBeep: true - visualBeep: false @acceptsDocuments: true @@ -224,6 +224,11 @@ class RootView extends View else @setTitle('untitled') + # Public: Trigger alert sound and `beep` event + beep: -> + shell.beep() if config.get('core.audioBeep') + @trigger 'beep' + # Public: Sets the application's title. setTitle: (title) -> document.title = title diff --git a/static/utilities.less b/static/utilities.less index ae7ef14aa..0a0183ce6 100644 --- a/static/utilities.less +++ b/static/utilities.less @@ -61,23 +61,6 @@ div > .inline-block-tight:last-child { } } -.visual-beep { - z-index: 1000; - width: 100%; - height: 100%; - position: fixed; - top: 0; - right: 0; - opacity: 0.0; - -webkit-animation: visual-beep-flash 0.2s ease-out; - background: @background-color-warning; -} - -@-webkit-keyframes visual-beep-flash { - 0% { opacity: 0.5 } - 100% {opacity: 0.0 } -} - .error { -webkit-animation: flash-error 0.3s ease-in; } From 5d35f52174b2850343eef7eddd2da5fce5640dab Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 11:12:27 -0700 Subject: [PATCH 07/13] Add Visual Beep to default packages --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index d527b52d3..99b7d4d3f 100644 --- a/package.json +++ b/package.json @@ -107,6 +107,7 @@ "to-the-hubs": "0.8.0", "toml": "0.3.0", "tree-view": "0.20.0", + "visual-beep": "0.1.0", "whitespace": "0.7.0", "wrap-guide": "0.4.0", From 224bc56d4e99fe24f1c2f82bd291f6165b7e2d00 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 11:15:57 -0700 Subject: [PATCH 08/13] Require $$ via space-pen-extensions --- src/atom.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 6db82faab..2101dc67d 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -5,13 +5,12 @@ Emitter::trigger = (args...) -> @emit(args...) Emitter::subscriptionCount = (args...) -> @getSubscriptionCount(args...) fsUtils = require './fs-utils' -{$} = require './space-pen-extensions' +{$, $$} = require './space-pen-extensions' _ = require 'underscore-plus' Package = require './package' ipc = require 'ipc' remote = require 'remote' shell = require 'shell' -{$$} = require 'space-pen' crypto = require 'crypto' path = require 'path' os = require 'os' From c513c55f7aeb164f383469f6323ec618a22be6ae Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 11:38:19 -0700 Subject: [PATCH 09/13] Update visual-beep package name to visual-bell --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99b7d4d3f..ef9dec154 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "to-the-hubs": "0.8.0", "toml": "0.3.0", "tree-view": "0.20.0", - "visual-beep": "0.1.0", + "visual-bell": "0.2.0", "whitespace": "0.7.0", "wrap-guide": "0.4.0", From 42e269a7ceb7381cb906ceb16f3dad0b00906d3d Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 11:57:21 -0700 Subject: [PATCH 10/13] Update visual bell to v0.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef9dec154..2c7c5747d 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "to-the-hubs": "0.8.0", "toml": "0.3.0", "tree-view": "0.20.0", - "visual-bell": "0.2.0", + "visual-bell": "0.3.0", "whitespace": "0.7.0", "wrap-guide": "0.4.0", From d5f92ef59d724611296732d50a523d92a7c73bb8 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 14:09:00 -0700 Subject: [PATCH 11/13] Move all beep code into Atom class --- src/atom.coffee | 3 ++- src/root-view.coffee | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/atom.coffee b/src/atom.coffee index 2101dc67d..993e153c1 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -303,7 +303,8 @@ class Atom process.crash() beep: -> - @rootView.beep() + shell.beep() if config.get('core.audioBeep') + @rootView.trigger 'beep' requireUserInitScript: -> userInitScriptPath = path.join(@config.configDirPath, "user.coffee") diff --git a/src/root-view.coffee b/src/root-view.coffee index a05639233..c483d292e 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -2,7 +2,6 @@ fs = require 'fs' ipc = require 'ipc' path = require 'path' Q = require 'q' -shell = require 'shell' {$, $$, View} = require './space-pen-extensions' fsUtils = require './fs-utils' _ = require 'underscore-plus' @@ -224,11 +223,6 @@ class RootView extends View else @setTitle('untitled') - # Public: Trigger alert sound and `beep` event - beep: -> - shell.beep() if config.get('core.audioBeep') - @trigger 'beep' - # Public: Sets the application's title. setTitle: (title) -> document.title = title From f7dfd6001466c59d9ddddd38ed38425e6710b9af Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 14:14:47 -0700 Subject: [PATCH 12/13] Remove unused $$ --- src/atom.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom.coffee b/src/atom.coffee index 993e153c1..9736149bd 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -5,7 +5,7 @@ Emitter::trigger = (args...) -> @emit(args...) Emitter::subscriptionCount = (args...) -> @getSubscriptionCount(args...) fsUtils = require './fs-utils' -{$, $$} = require './space-pen-extensions' +{$} = require './space-pen-extensions' _ = require 'underscore-plus' Package = require './package' ipc = require 'ipc' From 4ad38eed8723a2d37583dac2e84b1f33007f6346 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Wed, 23 Oct 2013 14:26:48 -0700 Subject: [PATCH 13/13] Use @config instead of config --- src/atom.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/atom.coffee b/src/atom.coffee index 9736149bd..0048f8397 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -303,7 +303,7 @@ class Atom process.crash() beep: -> - shell.beep() if config.get('core.audioBeep') + shell.beep() if @config.get('core.audioBeep') @rootView.trigger 'beep' requireUserInitScript: ->