Open MatthiasGrandl opened 11 months ago
I'm 100% agree that it needs to be monospaced. The menu bar is programmed in Swift UI and I tried to make it monospaced but it didn't work.
I suspect that macOS simply doesn't allow changing the font of the tray items. Are there any known apps that show their tray item in monospaced? macOS clock doesn't count. It's a system thing, it can have more privileges
So could it be worked around with icons? I am not at all familiar with SwiftUI MacOS programming.
But yeah I expected this to not be super straightforward :)
So could it be worked around with icons?
The tray icon shows workspace names. Workspace names are not necessarily single-lettered
When I was using Amethyst, I also used a companion app called SpaceId, and the latter seems to be using Swift code to generate the tray icon.
It works pretty well actually:
Unfortunately I have to stop using it due to AeroSpace having its own virtual desktop system (which is great in general except for this tiny detail).
I imagine having as many icons as my active monitors (the current ordering seems fine), each showing the identifier of the current virtual desktop of that monitor (just considering the case of 1-2 letters would be fine for most cases I believe). If a monitor is unbound, a ?
is used instead.
SpaceId looks fantastic, and of course I find it via this thread, right as it becomes useless to me since I'm switching to Aerospace.
:+1: to adding a list of spaces to the titlebar, that doesn't shift around often.
(My vote would be: show all spaces that have ≥1 window; with the current one highlighted dynamically switch around between them.)
I wonder if generating a tiny image with the text would work.
I tried copying SpaceId's source code in and here is how it looks
So could it be worked around with icons?
The tray icon shows workspace names. Workspace names are not necessarily single-lettered
Sadly this currently doesn't work with [s]
prefixes and multiple letters (but should be technically feasible)
I suspect that macOS simply doesn't allow changing the font of the tray items. Are there any known apps that show their tray item in monospaced? macOS clock doesn't count. It's a system thing, it can have more privileges
Following SpaceId's code, making it monospace should be possible by drawing an image just as @graywolf said
I have something working, anyone willing to give it a try? https://github.com/steliyan/AeroSpace/tree/menubar-monospaced
Screenshot:
To be honest, not sure if this is the best way (using @MainActor
), but haven't really got the time to understand how SwiftUI works.
The cool thing is we can keep everything else the same, still a text is rendered, not fancy custom drawing logic. Also, this provides the ability to have something like the 2nd line (the 1st line is what we currently have):
The only way to display custom items in the menubar appears to be through the use of AppKit. I successfully implemented this approach: https://github.com/frostplexx/AeroSpace/tree/monospace-menubar, and it generally works well, except for a few minor fixable bugs.
The code is a bit messy, but it would also allow us to use any arbitrary SwiftUI view as the menu bar icon. Additionally, it would enable the use of custom fonts (configured by the user in the config file). For instance, users can set the workspace names to icons of their choice using a nerd font.
So I really love the subtle menubar that shows the current space. However the default font doesn't lend itself very well to this purpose as the different numbers/letters, have different widths, causing other menubar items to jump when switching spaces. The use of a monospaced font would alleviate this.
For example the MacOS default clock in the right of the menu bar seems to be using the equivalent of CSS:
font-variant-numeric: tabular-nums;
to prevent jumping.