1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-17 03:31:52 +00:00

exclude finder

This commit is contained in:
Rokt33r
2015-10-18 20:55:42 +09:00
parent 0bdb8142c6
commit 55db0bebbb
2 changed files with 51 additions and 51 deletions

100
main.js
View File

@@ -95,59 +95,59 @@ app.on('ready', function () {
mainWindow.show() mainWindow.show()
}) })
finderWindow = require('./atom-lib/finder-window') // finderWindow = require('./atom-lib/finder-window')
var globalShortcut = require('global-shortcut') // var globalShortcut = require('global-shortcut')
console.log('jetpack launch') // console.log('jetpack launch')
var userDataPath = app.getPath('userData') // var userDataPath = app.getPath('userData')
if (!jetpack.cwd(userDataPath).exists('keymap.json')) { // if (!jetpack.cwd(userDataPath).exists('keymap.json')) {
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'}) // jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
} // }
try { // try {
global.keymap = JSON.parse(jetpack.cwd(userDataPath).read('keymap.json', 'utf-8')) // global.keymap = JSON.parse(jetpack.cwd(userDataPath).read('keymap.json', 'utf-8'))
} catch (err) { // } catch (err) {
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'}) // jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
global.keymap = {} // global.keymap = {}
} // }
if (global.keymap.toggleFinder == null) global.keymap.toggleFinder = 'ctrl+tab+shift' // if (global.keymap.toggleFinder == null) global.keymap.toggleFinder = 'ctrl+tab+shift'
var toggleFinderKey = global.keymap.toggleFinder // var toggleFinderKey = global.keymap.toggleFinder
try { // try {
globalShortcut.register(toggleFinderKey, function () { // globalShortcut.register(toggleFinderKey, function () {
if (mainWindow != null && !mainWindow.isFocused()) { // if (mainWindow != null && !mainWindow.isFocused()) {
mainWindow.hide() // mainWindow.hide()
} // }
finderWindow.show() // finderWindow.show()
}) // })
} catch (err) { // } catch (err) {
console.log(err.name) // console.log(err.name)
} // }
ipc.on('hotkeyUpdated', function (event, newKeymap) { // ipc.on('hotkeyUpdated', function (event, newKeymap) {
console.log('got new keymap') // console.log('got new keymap')
console.log(newKeymap) // console.log(newKeymap)
globalShortcut.unregisterAll() // globalShortcut.unregisterAll()
global.keymap = JSON.parse(newKeymap) // global.keymap = JSON.parse(newKeymap)
jetpack.cwd(userDataPath).file('keymap.json', {content: JSON.stringify(global.keymap)}) // jetpack.cwd(userDataPath).file('keymap.json', {content: JSON.stringify(global.keymap)})
var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift' // var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift'
try { // try {
globalShortcut.register(toggleFinderKey, function () { // globalShortcut.register(toggleFinderKey, function () {
if (mainWindow != null && !mainWindow.isFocused()) { // if (mainWindow != null && !mainWindow.isFocused()) {
mainWindow.hide() // mainWindow.hide()
} // }
finderWindow.show() // finderWindow.show()
}) // })
} catch (err) { // } catch (err) {
console.log(err.name) // console.log(err.name)
} // }
}) // })
global.hideFinder = function () { // global.hideFinder = function () {
if (!mainWindow.isVisible()) { // if (!mainWindow.isVisible()) {
Menu.sendActionToFirstResponder('hide:') // Menu.sendActionToFirstResponder('hide:')
} else { // } else {
mainWindow.focus() // mainWindow.focus()
} // }
} // }
}) })

View File

@@ -1,6 +1,6 @@
{ {
"name": "boost", "name": "boost",
"version": "0.4.0", "version": "0.4.0-alpha",
"description": "Boost App", "description": "Boost App",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {