Move beep method to rootView

This commit is contained in:
probablycorey
2013-10-23 10:41:21 -07:00
parent 3b525302b0
commit ffcd948362
3 changed files with 7 additions and 28 deletions

View File

@@ -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")

View File

@@ -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

View File

@@ -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;
}