Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ export default class InitiativeTracker extends Plugin {
);

this.app.workspace.onLayoutReady(async () => {
this.addTrackerView();
this.addTrackerView(true);
//Update players from < 7.2
for (const player of this.data.players) {
if (player.path) continue;
Expand Down Expand Up @@ -629,7 +629,10 @@ export default class InitiativeTracker extends Plugin {
console.log("Initiative Tracker unloaded");
}

async addTrackerView() {
async addTrackerView(startup = false) {
if (startup && !this.data.showLeafOnStartup) {
return;
}
if (
this.app.workspace.getLeavesOfType(INITIATIVE_TRACKER_VIEW)?.length
) {
Expand Down
13 changes: 13 additions & 0 deletions src/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ export default class InitiativeTrackerSettings extends PluginSettingTab {
private _displayBase(containerEl: HTMLDivElement) {
containerEl.empty();
new Setting(containerEl).setHeading().setName("Basic Settings");
new Setting(containerEl)
.setName("Open Initiative Tracker on Startup")
.setDesc(
"The tracker can always be opened using the command from the command palette."
)
.addToggle((t) => {
t.setValue(this.plugin.data.showLeafOnStartup).onChange(
async (v) => {
this.plugin.data.showLeafOnStartup = v;
await this.plugin.saveSettings();
}
);
});
new Setting(containerEl)
.setName("Display Beginner Tips")
.setDesc(
Expand Down
2 changes: 2 additions & 0 deletions src/settings/settings.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type { BuilderState } from "src/builder/builder.types";
export interface InitiativeTrackerData {
beginnerTips: boolean;
displayDifficulty: boolean;
/** When true, open the Initiative Tracker side leaf on vault startup. */
showLeafOnStartup: boolean;
preferStatblockLink: boolean;
statuses: Condition[];
unconsciousId: string;
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const DEFAULT_SETTINGS: InitiativeTrackerData = {
autoStatus: true,
beginnerTips: true,
displayDifficulty: true,
showLeafOnStartup: true,
encounters: {},
warnedAboutImports: false,
openState: {
Expand Down