【发布时间】:2017-04-20 17:42:35
【问题描述】:
在 Linux 上使用 Atom 编辑器时,我似乎无法在最近处于活动状态的 Atom 窗口中找到任何打开文件的选项(使用我的文件管理器)。相反,它总是在创建的第一个 Atom 窗口中打开。
我该如何解决这个问题?
【问题讨论】:
标签: linux atom-editor archlinux
在 Linux 上使用 Atom 编辑器时,我似乎无法在最近处于活动状态的 Atom 窗口中找到任何打开文件的选项(使用我的文件管理器)。相反,它总是在创建的第一个 Atom 窗口中打开。
我该如何解决这个问题?
【问题讨论】:
标签: linux atom-editor archlinux
有一个选项:
-a, --add Open path as a new project in last used window. [boolean]
……但无论如何,它并没有按预期工作。不过,我找到了解决方法。
此代码位于src/main-process/atom-application.js 的第 862 行附近:
if (existingWindow == null) {
if (currentWindow = window != null ? window : this.lastFocusedWindow) {
if (addToLastWindow || currentWindow.devMode === devMode && (stats.every(function(stat) {
return typeof stat.isFile === "function" ? stat.isFile() : void 0;
}) || stats.some(function(stat) {
return (typeof stat.isDirectory === "function" ? stat.isDirectory() : void 0) && !currentWindow.hasProjectPath();
}))) {
existingWindow = currentWindow;
}
}
}
注释掉第一行和它之前的右括号:
// if (existingWindow == null) {
if (currentWindow = window != null ? window : this.lastFocusedWindow) {
if (addToLastWindow || currentWindow.devMode === devMode && (stats.every(function(stat) {
return typeof stat.isFile === "function" ? stat.isFile() : void 0;
}) || stats.some(function(stat) {
return (typeof stat.isDirectory === "function" ? stat.isDirectory() : void 0) && !currentWindow.hasProjectPath();
}))) {
existingWindow = currentWindow;
}
}
// }
…aaa 瞧!
这是一个可破解的文本编辑器,毕竟^_^
【讨论】:
this.windowForPaths 和 this.lastFocusedWindow 的优先级。
this.windowForPaths 和 this.lastFocusedWindow 的优先级?