1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +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()
})
finderWindow = require('./atom-lib/finder-window')
// finderWindow = require('./atom-lib/finder-window')
var globalShortcut = require('global-shortcut')
console.log('jetpack launch')
var userDataPath = app.getPath('userData')
if (!jetpack.cwd(userDataPath).exists('keymap.json')) {
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
}
try {
global.keymap = JSON.parse(jetpack.cwd(userDataPath).read('keymap.json', 'utf-8'))
} catch (err) {
jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
global.keymap = {}
}
if (global.keymap.toggleFinder == null) global.keymap.toggleFinder = 'ctrl+tab+shift'
var toggleFinderKey = global.keymap.toggleFinder
// var globalShortcut = require('global-shortcut')
// console.log('jetpack launch')
// var userDataPath = app.getPath('userData')
// if (!jetpack.cwd(userDataPath).exists('keymap.json')) {
// jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
// }
// try {
// global.keymap = JSON.parse(jetpack.cwd(userDataPath).read('keymap.json', 'utf-8'))
// } catch (err) {
// jetpack.cwd(userDataPath).file('keymap.json', {content: '{}'})
// global.keymap = {}
// }
// if (global.keymap.toggleFinder == null) global.keymap.toggleFinder = 'ctrl+tab+shift'
// var toggleFinderKey = global.keymap.toggleFinder
try {
globalShortcut.register(toggleFinderKey, function () {
if (mainWindow != null && !mainWindow.isFocused()) {
mainWindow.hide()
}
finderWindow.show()
})
} catch (err) {
console.log(err.name)
}
// try {
// globalShortcut.register(toggleFinderKey, function () {
// if (mainWindow != null && !mainWindow.isFocused()) {
// mainWindow.hide()
// }
// finderWindow.show()
// })
// } catch (err) {
// console.log(err.name)
// }
ipc.on('hotkeyUpdated', function (event, newKeymap) {
console.log('got new keymap')
console.log(newKeymap)
globalShortcut.unregisterAll()
global.keymap = JSON.parse(newKeymap)
jetpack.cwd(userDataPath).file('keymap.json', {content: JSON.stringify(global.keymap)})
// ipc.on('hotkeyUpdated', function (event, newKeymap) {
// console.log('got new keymap')
// console.log(newKeymap)
// globalShortcut.unregisterAll()
// global.keymap = JSON.parse(newKeymap)
// jetpack.cwd(userDataPath).file('keymap.json', {content: JSON.stringify(global.keymap)})
var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift'
try {
globalShortcut.register(toggleFinderKey, function () {
if (mainWindow != null && !mainWindow.isFocused()) {
mainWindow.hide()
}
finderWindow.show()
})
} catch (err) {
console.log(err.name)
}
})
// var toggleFinderKey = global.keymap.toggleFinder != null ? global.keymap.toggleFinder : 'ctrl+tab+shift'
// try {
// globalShortcut.register(toggleFinderKey, function () {
// if (mainWindow != null && !mainWindow.isFocused()) {
// mainWindow.hide()
// }
// finderWindow.show()
// })
// } catch (err) {
// console.log(err.name)
// }
// })
global.hideFinder = function () {
if (!mainWindow.isVisible()) {
Menu.sendActionToFirstResponder('hide:')
} else {
mainWindow.focus()
}
}
// global.hideFinder = function () {
// if (!mainWindow.isVisible()) {
// Menu.sendActionToFirstResponder('hide:')
// } else {
// mainWindow.focus()
// }
// }
})

View File

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