alangrainger / obsidian-lazy-plugins

Load plugins with a delay on Obsidian startup, so that you can get your app startup down into the sub-second loading time.
MIT License
186 stars 0 forks source link

Put ribbon / sidebar icons back into original order once plugins are loaded #2

Open samaellain opened 1 month ago

samaellain commented 1 month ago

@alangrainger adds:

If there's enough interest I will make a companion plugin to Lazy Loader. It's pretty simple - the companion plugin would have a settings page with a draggable list of plugins so you can re-order them however you like.

Then it would hook into the plugin enabled event and rearrange the icons to your specified order whenever any plugin loads.


Original post:

Expected Behavior

The plugins that were set to be delayed should retain the order in the ribbon.

Actual Behavior

The plugins set to be delayed are placed in random order.

Steps to Reproduce

Delay the start of a plugin.
Arrange the ribbon icons in custom order.
Restart Obsidian.
Plugins icons are placed in random order.

Additional Information

Obsidian Version: v1.6.7
Plugin Version: 1.0.4
Operating System: Windows 11

Obsidian place the icons in the ribbon at the moment the plugin is enabled, I'm not sure if there's a way to work around this and retain the custom order.

LemurTech commented 1 month ago

It's also loading icons in the ribbon that were previously disabled.

alangrainger commented 1 month ago

I have updated in v1.0.5 to always load plugins in alphabetical order (with a short staggered delay between loading to give it the best chance to always be the same order).

To truly solve what you're asking for, there would need to be a setting in the plugin to choose the loading order. Obsidian doesn't have any UX components for reordering a list built in, so it would need to be created which would add additional complexity and loading time to the Lazy plugin. I will consider it, but no promises.

Another option would be to use an existing plugin like https://github.com/Opisek/obsidian-statusbar-organizer , and have that load as a long delay after your other plugins.

samaellain commented 1 month ago

Hey @alangrainger the order and visibility of the icons in the ribbon are saved by obsidian in workspace.json. Something like: "left-ribbon": { "hiddenItems": { "homepage:Open homepage": false, "switcher:Open quick switcher": true, "graph:Open graph view": false, "canvas:Create new canvas": true, "daily-notes:Open today's daily note": false, "command-palette:Open command palette": false, "obsidian-read-it-later:ReadItLater: Save clipboard": false, "obsidian42-brat:BRAT": false, "obsidian-local-images-plus:Local Images Plus 0.15.9\r\nLocalize attachments (plugin folder)": false, "templater-obsidian:Templater": false, "obsidian-projects:Open projects": false, "cmdr:Open settings": false }

Can the plugin somehow read this configuration and use it to solve this problem? If possible, this would also solve the problem that @LemurTech reported about hidden icons reappearing.

LemurTech commented 1 month ago

I think my issue was that the Workspaces plugin had somehow gotten disabled--which is odd because I always leave it enabled. But that is fixed now.

alangrainger commented 1 month ago

I'll leave this issue open as if there's enough interest I will make a companion plugin to Lazy Loader.

It's very simple - the companion plugin would have a settings page with a draggable list of plugins so you can re-order them however you like.

Then it would hook into the plugin enabled event and rearrange the icons to your specified order whenever any plugin loads.

LemurTech commented 4 weeks ago

@alangrainger, do you know of a reasonable solution for the issue of ribbon plugins getting loaded after the Workspaces core plugin has loaded? Workspaces will apply icon visibility preferences, but then it just gets wiped out as the Lazy Loader does its thing. I end up having to reapply my Workspace setting if I then want to get rid of all those extra icons. Of course, I could just sacrifice having the ribbon and wean myself away from it, but I do use it at present.

alangrainger commented 4 weeks ago

@LemurTech Sorry, no workaround for that yet. That core plugin is not designed to listen for other plugin changes and then update its icons.

It will require a companion plugin to Lazy Loader which I mention here: https://github.com/alangrainger/obsidian-lazy-plugins/issues/2#issuecomment-2288334961