Automatically show nodes based on rules
Description
I would appreciate a way to hide nodes based on certain conditions (eg. a simple command) so one could hide a "run command" node if the command is not available (by using a check like command -v COMMAND_TO_RUN) and maybe subsequently hide menu nodes if all their children are hidden.
This could be done when the menu config is parsed so it should probably not be a performance bottleneck.
My usecase for this is that i sync my menu config between a personal and a work machine so i am using the same structure automatically, however some programs (ie. Jetbrains IDEs) are only used and installed on my work machine so the menu on my personal machine is kinda pointless.
Affected Desktop Environments
All
Additional Information
No response
Hi there! Thanks for the suggestion! I see your point, but there is one issue: It would be very bad if the other menu items changed their position if some menu items would be removed from the menu layout. This would mean that menu items would be in different positions on your different machines making it much harder for you to learn the gestures.
So it must be implemented in a way which leaves gaps where the hidden items would be. So effectively it would only make the items invisible. And then I'm not 100% sure if it's worth the effort... It would mean rather complex additional code and new UI elements for just making some menu items invisible 😅
i see your point, however the lock feature can be used to keep menu items in a fixed position? i feel like it is like adding a new submenu to an established (and potentially already memorized) menu layout where one also adjusts and potentially locks nodes. It is no dealbreaker, however it would be an awesome polish
I think it can be implemented like a grayed-out node, which can't be dragged or clicked. On the UI side, it's just the "Disable node" property. In that way, it doesn't ruin the layout of the menu
Yeah, but I think the point is that the menu item should be automatically disabled or enabled based on the output of some command.
I don't think it's very easy to implement. Also, when this command needs to run, how long would it take to get the output of the command? Is it possible to use Flatpak? I think it could be as simple as a checkbox. If you want this behaviour, I think you can create a script that will delete/comment unnecessary nodes based on the command output.