Skip to content

Commit

Permalink
feat: add setting to hide file menu actions
Browse files Browse the repository at this point in the history
close #456
  • Loading branch information
Vinzent03 committed Mar 20, 2023
1 parent 1304917 commit a59d38a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const DEFAULT_SETTINGS: Omit<ObsidianGitSettings, "autoCommitMessage"> =
setLastSaveToLastCommit: false,
submoduleRecurseCheckout: false,
gitDir: "",
showFileMenu: true,
};

export const GIT_VIEW_CONFIG = {
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,7 @@ export default class ObsidianGit extends Plugin {
}

handleFileMenu(menu: Menu, file: TAbstractFile, source: string): void {
if (!this.settings.showFileMenu) return;
if (source !== "file-explorer-context-menu") {
return;
}
Expand Down
11 changes: 11 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,17 @@ export class ObsidianGitSettingsTab extends PluginSettingTab {
})
);

new Setting(containerEl)
.setName("Show stage/unstage button in file menu")
.addToggle((toggle) =>
toggle
.setValue(plugin.settings.showFileMenu)
.onChange((value) => {
plugin.settings.showFileMenu = value;
plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Show branch status bar")
.setDesc(
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface ObsidianGitSettings {
showBranchStatusBar: boolean;
setLastSaveToLastCommit: boolean;
gitDir: string;
showFileMenu: boolean;
}

export type SyncMethod = "rebase" | "merge" | "reset";
Expand Down

0 comments on commit a59d38a

Please sign in to comment.