New Plugin: Hide Commands in Menu

Hide Commands in Menu

This plugin allows you to hide any commands, including those from community plugins.

kzhovn has excellent obsidian-customizable-menu plugin, but it can’t hide different command in different menus, so I try to create one.

Github repo: GitHub - bomian98/obsidian-hide-commands-in-menu
Install: Plugins - Obsidian

Features

  • Hide different commands across various menus in Obsidian.
  • Automatically remove redundant dividers when commands are hidden.
  • Inject different CSS classes for menu styling control.
  • Use regex pattern matching for advanced rule configurations.

Menu Types

Menu Types

Menu Type Trigger Location
file-menu (tab-header) Right-click file tab
file-menu (more-options) Click workspace ··· button
file-menu (file-explorer) Right-click file/folder in explorer
file-menu (link) Right-click internal link
files-menu (file-explorer) Right-click multiple explorer items
editor-menu Right-click in editor view
url-menu Right-click external link
other-menu Any other menu

Note: When in the editor view, right-clicking a link will also trigger either the url-menu or file-menu (link).

To examine the displayed menu, utilize Obsidian’s Developer Tools to inspect the menu’s HTML class.

Customize Styles

  • Select hide-commands: div.custom-menu-hide-item
  • Select hide-separators: div.custom-menu-hide-separator
  • Select different menus:
Menu Type CSS Selector
file-menu (tab-header) .file-menu-tab-header
file-menu (more-options) .file-menu-more-options
file-menu (file-explorer) .file-menu-file-explorer-context-menu
file-menu (link) .file-menu-link-context-menu
files-menu (file-explorer) .files-menu-file-explorer-context-menu
editor-menu .editor-menu
url-menu .url-menu
other-menu [class="menu"]

Give feedbacks

The settingTab UI of this plugin is not good. It would be my pleasure if someone can give suggestions for improvement.

Suggestions for other issues of this plugin are also welcome!

My problem was having too many Templater commands. Can you regex out these commands with ^Create.*?template or something similar from Command Palette or only UI items can be targeted?

In which menu do your Templater commands appear? First, you can go to the “Menu Type” section and identify the menu type. Then, in the settings tab, enter ^Create.*?template in the “Enter commands to hide (regex format)” text field of the corresponding menu type.

I wrote: Command Palette.

The Command Palette is not a menu, so this plugin cannot solve your problem. If you think there are too many commands on the Command Palette, you can configure the pinned commands of the Command Palette in the settings.

Hmm, thanks, I’ll look into it!