Templater icon indicating copy to clipboard operation
Templater copied to clipboard

Add templater ribbon/sidebar button toggle

Open fmbarina opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. I never use the ribbon/sidebar icon, so I wish I could just remove it to make things look tidier.

Describe the solution you'd like A toggle inside the plugin options to hide/show the ribbon icon. I think every plugin with a ribbon icon would do well to have this, to be honest.

Describe alternatives you've considered

  • Pretty sure it's possible with custom CSS.
  • phibr0/obsidian-customizable-sidebar has a "Hide Templater?" option.
  • Disabling Templater removes the icon.

But these solutions bring small downsides, such as needing external plugins or being somwhat inconvenient.

If you have any ideas or opinions regarding this, I'd love to hear them.

I tried writing the code myself, and it seems to work. I do not have experience with this kind of thing. May I open a PR for the implementation of this feature?

fmbarina avatar May 27 '22 04:05 fmbarina

That is a good request! I have thought about this but I totally forgot about it. After a bit of fiddling, this is what worked for me:

  1. You can use this to hide all of those action ribbons:
<%* this.app.workspace.leftRibbon.ribbonActionsEl.hidden = true %>
  1. Or you can use this to hide the templater ribbon only:
<%* 
var actionRibbons = this.app.workspace.leftRibbon.ribbonActionsEl.childNodes
for (var i = 0; i < actionRibbons.length; i++) {
    if (actionRibbons[i].ariaLabel == "Templater") {
        actionRibbons[i].hidden = true
    }
} 
%>

You can add to it to hide other ribbons as well. You can add this to a Templater Startup Template so these ribbons can be hidden on startup.

Hope that helps.

~Welp

welpdx avatar May 27 '22 20:05 welpdx

Thank you, I hadn't even thought about using a startup template. I like that this way, the problem is solved with Templater itself and no changes are required.

Despite that, I still think a toggle in the plugin options would be better though, since:

  • There's no need to use a startup template, it's just one click in the options.
  • Other people who might want this will benefit without having to find this issue.

I hope I'm not being too demanding about this, this is just my honest opinion. I've seen some PRs where people just offer the enhancement, no issue needed, so I was wondering if I should try making one as well.

fmbarina avatar May 27 '22 22:05 fmbarina

Hey @fmbarina, it is not demanding at all. In fact, I think that user feedback and user requests is what makes obsidian, templater, and softwares in general, better.

And thank you for clarifying what you wanted: an additional options in obisidan (not a templater snippet. ~opps!).

I guess my solution can be considered a temporary hack for you or others until your request is fully implemented.

~Welp

welpdx avatar May 27 '22 22:05 welpdx