Skip to content

Commit

Permalink
Add config to open results in output pane by default
Browse files Browse the repository at this point in the history
- closes nteract#995
  • Loading branch information
BenRussert committed Oct 2, 2017
1 parent 99b7b3d commit c28f875
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,18 @@ const Config = {
default: "{}"
},
outputAreaDock: {
title: "Output Area Dock",
title: "Leave output dock open",
description:
"Do not close dock when switching to an editor without a running kernel",
type: "boolean",
default: false
},
outputAreaDefault: {
title: "View output in the dock by default",
description:
"If enabled, output will be displayed in the dock by default rather than inline",
type: "boolean",
default: false
}
}
};
Expand Down
13 changes: 10 additions & 3 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "atom";

import _ from "lodash";
import { autorun } from "mobx";
import { autorun, when } from "mobx";
import React from "react";

import KernelPicker from "./kernel-picker";
Expand Down Expand Up @@ -40,7 +40,6 @@ import AutocompleteProvider from "./autocomplete-provider";
import HydrogenProvider from "./plugin-api/hydrogen-provider";
import {
log,
focus,
reactFactory,
isMultilanguageGrammar,
renderDevTools,
Expand Down Expand Up @@ -223,6 +222,15 @@ const Hydrogen = {
autorun(() => {
this.emitter.emit("did-change-kernel", store.kernel);
});

when(
"When the first kernel started open output area",
() => store.runningKernels.length > 0,
() => {
if (!atom.config.get("Hydrogen.outputAreaDefault")) return;
openOrShowDock(OUTPUT_AREA_URI);
}
);
},

deactivate() {
Expand Down Expand Up @@ -370,7 +378,6 @@ const Hydrogen = {

if (store.kernel !== kernel) return;
await openOrShowDock(OUTPUT_AREA_URI);
focus(store.editor);
}
});
},
Expand Down

0 comments on commit c28f875

Please sign in to comment.