knurling / ServiceStation

Service Station
39 stars 1 forks source link

Duplicate items should be filtered so only 1 is shown #41

Closed luckman212 closed 3 years ago

luckman212 commented 4 years ago

I have Sublime Text registered as an item for Text as well as Any: image

This causes it to appear twice in the SS menu: image

It would be good for items to be de-duped before the menu is rendered if they are identical.

weavermedia commented 4 years ago

Which one should be shown? Should it show the first one that matches? Or the one that matches most specifically (ie by matching the most rules)? Or another filter method?

luckman212 commented 4 years ago

I think they should all be shown, but filtered so that exact duplicate actions (e.g. identical App bundle or script path) should only show a single result.

weavermedia commented 4 years ago

Indeed, but I was asking which duplicate(s) should be omitted and which single instance should be shown? That will affect the placement of the item in the menu. In your example would you expect to see:

Sublime Text TextEdit Xcode

or

TextEdit Xcode Sublime Text

This would be more pronounced the longer the menu list as you would expect to see an item in a certain place every time.

Also, if you have an app/script in the 'Any' rule wouldn't it just be easier to not add it to any other more specific rules?

luckman212 commented 4 years ago

I'm imagining programmatically it would be easier to skip the duplicate items when building the array of menuitems, rather than remove the previous entries and reinsert them at the end. So it would be

Sublime Text TextEdit Xcode

And yes—you're right about just not adding the "Any" items to the other categories as a partial solution. I realized that some time after my original post, just forgot to comment.

pkamb commented 3 years ago

Thanks for this suggestion! Duplicates will be removed in version 2020.9, coming soon to the Mac App Store.

The order of menu items is determined by the order of Rules/Items in the UI. This change keeps the first exact-duplicate Item and hides the rest.


Old:

Screen Shot 2020-12-07 at 2 49 39 PM

New:

Screen Shot 2020-12-07 at 2 50 00 PM
luckman212 commented 3 years ago

Love it!

pkamb commented 3 years ago

Very fast Mac App Store review. This is now released in v2020.9 🚀