Add paths to duplicate browser names in Settings#5210
Open
mven wants to merge 1 commit intoRanchero-Software:mainfrom
Open
Add paths to duplicate browser names in Settings#5210mven wants to merge 1 commit intoRanchero-Software:mainfrom
mven wants to merge 1 commit intoRanchero-Software:mainfrom
Conversation
mven
commented
Mar 24, 2026
| menu.addItem(item) | ||
| menu.addItem(NSMenuItem.separator()) | ||
|
|
||
| let baseFont = NSFont.menuFont(ofSize: 0) |
Author
There was a problem hiding this comment.
Not sure if this is the best place for these constants.
mven
commented
Mar 24, 2026
|
|
||
| let item = NSMenuItem(title: name, action: nil, keyEquivalent: "") | ||
| item.representedObject = browser.bundleIdentifier | ||
| item.representedObject = browser.bundlePath |
Author
There was a problem hiding this comment.
I used the path instead of bundleIdentifier, because bundleIdentifier wasn't unique when duplicate browsers exist.
mven
commented
Mar 24, 2026
| if let leftName = $0.name, let rightName = $1.name { | ||
| return leftName < rightName | ||
| if let leftName = $0.name, let leftPath = $0.bundlePath, let rightName = $1.name, let rightPath = $1.bundlePath { | ||
| return (leftName, leftPath) < (rightName, rightPath) |
Author
There was a problem hiding this comment.
Make sure browsers are sorted by name AND path
mven
commented
Mar 24, 2026
| let pathThreshold = 4 | ||
|
|
||
| // index 0 is `/` with absolute path | ||
| let pathStart = "\(pathComponents[0])\(pathComponents[1])" |
Author
There was a problem hiding this comment.
I'm not too crazy about the way this looks, since it looks a little messy. I'm open to suggestions or any best practices I'm unaware of.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds an informative path name if duplicate browsers are present in
Settings > BrowserNotable changes:
bundlePathcomputed propertybundlePathoverbundleIdentifierinrepresentedObjectto make menu items more uniqueswiftlintwas performed on these specific files.closes #4747