mirror of
https://github.com/jesse-r-s-hines/obsidian-open-tab-settings.git
synced 2026-07-22 05:43:41 +00:00
Add command to cycle tab placement option
This commit is contained in:
parent
ccba100789
commit
b7013ab0fc
1 changed files with 13 additions and 1 deletions
14
src/main.ts
14
src/main.ts
|
|
@ -3,7 +3,9 @@ import {
|
|||
WorkspaceItem, Platform, Keymap, Notice,
|
||||
} from 'obsidian';
|
||||
import * as monkeyAround from 'monkey-around';
|
||||
import { OpenTabSettingsPluginSettingTab, OpenTabSettingsPluginSettings, DEFAULT_SETTINGS } from './settings';
|
||||
import {
|
||||
OpenTabSettingsPluginSettingTab, OpenTabSettingsPluginSettings, DEFAULT_SETTINGS, NEW_TAB_TAB_GROUP_PLACEMENTS,
|
||||
} from './settings';
|
||||
import { PaneTypePatch, TabGroup } from './types';
|
||||
|
||||
|
||||
|
|
@ -98,6 +100,16 @@ export default class OpenTabSettingsPlugin extends Plugin {
|
|||
},
|
||||
});
|
||||
}
|
||||
this.addCommand({
|
||||
id: `cycle-tab-group-placement`, name: `Cycle tab group placement`,
|
||||
callback: async () => {
|
||||
const values = Object.keys(NEW_TAB_TAB_GROUP_PLACEMENTS) as (keyof typeof NEW_TAB_TAB_GROUP_PLACEMENTS)[];
|
||||
const index = values.findIndex(v => v == this.settings.newTabTabGroupPlacement);
|
||||
const newValue = values[(index + 1) % values.length];
|
||||
await this.updateSettings({newTabTabGroupPlacement: newValue});
|
||||
new Notice(`Tab group placement: ${NEW_TAB_TAB_GROUP_PLACEMENTS[newValue]}`, 2500);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
registerMonkeyPatches() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue