feat: add tab stop to enable right-aligned content#463
feat: add tab stop to enable right-aligned content#463andyearnshaw wants to merge 1 commit intoswiftbar:mainfrom
Conversation
This adds a default tab stop to the menu item title, allowing for right-aligned text and images by using the \t character in the title string.
|
Hmm... I've just spotted #455, which makes me think a full approach might be more appropriate. Maybe I can get your thoughts on this @melonamin? |
|
I think that might be good enough as a default tab stop behaviour. However, it has some drawbacks and doesn't cover my use case because of these:
How do we know we are using the right amount of Allowing the plugin author to define tab stops makes the estimation easier, because you can make it so you only need a single I was originally thinking along the lines of one or two params that would allow the tab stops to be defined as well as the alignment, e.g. 1 param Or 2 params Naturally, the 1st is shorter and less noisy for the output, but the second would use simple splits rather than complex parsing. |
|
I also thought it might be cool if an author could define their tab stops in a single place to reduce line noise, e.g. |
Another (hopefully) quick win. This adds a single right-aligned tabstop to the menu item title text, which allows for images and text to be anchored on the right by separating them with the
\tcharacter.Example screenshot:
I've picked a default tab stop of 150 points, as I think this is reasonable enough as a first pass. However, I could add more tab stops for potentially wider menus. My original thought was to allow configurable tabstops through params, but I'm not sure what the format should look like as you'd need both a number for the location and an alignment string. I'm happy to follow up on this with improvements if there's a concrete approach. Either way, I think some level of default is useful.
Caveat: it doesn't look quite so good when there are submenus or badges, but it's great for submenus that don't have those things.