AlexBieg / obsidian-better-command-palette

A better command palette for obsidian
MIT License
163 stars 12 forks source link

[Feature Request] Hide Commands #36

Closed iamrecursion closed 2 years ago

iamrecursion commented 2 years ago

This has rapidly become one of the most indispensable plugins in my arsenal. I was wondering if there are any plans for the ability to hide certain commands from the command palette.

AlexBieg commented 2 years ago

Thanks! I'm glad this has been useful for you. At the moment that is not in the pipeline, but I'm happy to add it. Could you explain a bit more about the functionality you are looking for? As well as the problem this would solve for you? I want to make sure any new features I add are not too targeted for specific use-cases.

Also, hiding commands might run into people not remembering they hid a command and not being able to find it. How would you feel about some sort of priority system? Similar to the current pin system but with multiple levels. Priority 1s are shown before Priority 2s and so on. Maybe there could be some sort of Priority -1 which just means it should always be shown last if there are any higher priorities. Mostly just spitballing here so feel free to suggest something else

iamrecursion commented 2 years ago

Essentially, there are commands from certain plugins that I never use, but have similar-enough names to ones I do (often from the same plugin) that I often hit them by accident. Essentially, I'd like to be able to hide those commands such that they're not selectable in the command palette by accident.

I can think of a few ways that this could be accomplished:

  1. Your priorities idea would work, but in the case where there are other commands that closely match it would still admit the possibility of accidentally selecting it with the arrow keys (or via a typo making it the only option).
  2. There's the obvious "hide commands entirely".
  3. The one I'm most partial to would hide commands but show in the palette as the last entry N Hidden Commands. You would then be able to confirm-select (e.g. double enter or double tap) to expand those hidden commands and make them selectable.

For me at least, the 3rd item provides the best affordances for knowing that there are commands hidden, but this is just my vision of course!

AlexBieg commented 2 years ago

Ooh yeah, I like number 3. It might take a bit of refactoring to be able to hide commands based on a setting, but nothing too crazy. Adding in a new suggestion that functions differently than the others is interesting and I'm not exactly sure how the SuggestionModal will handle that. Alternatively, some visual affordance could say something like 3 matching hidden commands below the search box and a hot key combo to toggle showing them in the list like cmd+h. By default, it wouldn't show them, but you could always add them back with that hotkey. Open to push back, but if that sounds good I'll go ahead with that as the current plan.

iamrecursion commented 2 years ago

That sounds great! I only worry about not being able to unhide them on mobile due to not necessarily having a keyboard!

AlexBieg commented 2 years ago

Hey, @iamrecursion I just put out version 0.13.0 which includes this feature. I'm pretty happy with how it turned out, but let me know if you notice anything weird. The functionality works basically as we talked about with some very small exceptions. Hope it's helpful for you!

Quick summary:

  1. Each item in the suggestions area now has an X next to it
  2. Clicking that X hides that item
  3. Any kind of item can be hidden (Commands, Files, and Tags)
  4. Hidden items can be shown by clicking the Show hidden items message or using cmd+i
  5. Hidden items can be unhidden by clicking the plus next to them after they have been shown
iamrecursion commented 2 years ago

At a first blush this seems to work absolutely fantastically! Nothing strange has popped up for me on desktop or mobile, and it's instantly made a material difference to how fluidly I can use the command palette. Thank you so much!