macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.47k stars 680 forks source link

Add SF Symbol support for tool bar, Touch Bar, menu icons #1329

Closed ychin closed 1 year ago

ychin commented 1 year ago

Can now specify SF Symbols for tool bar / Touch Bar icons. The API remains the same where we use the "icon=" syntax in Vim menus to specify the icon, and just passing in the symbol name (e.g. 'gear.circle'). Also extended this to system named images like 'NSAdvanced' (the old gear shaped image), as previously we only had a specical case for Touch Bar system named template images. When loading the icon, MacVim will automatically determine whether it's an SF Symbol, system named image, or a file.

SF Symbols can also be customized to be of a particular symbol style, or have a variable number set, by using colon-delimted option strings. For example: aqi.high:palette:variable-0.5 is a symbol that uses the palette style, set to 0.5 variable value.

Menu items now also support icons, the same as tool bars. We still don't support specifying icons for a submenu (which has been an issue for Touch Bar) since the Vim menu API doesn't support a way to do so.

Also add an ability to use a :template value to specify that an image file is a template image. This is important to fix a minor regression introduced in #1214 where every image loaded in were assumed to be template.

Add documentation to make this clear. See :help macvim-toolbar-icon.

Also see comment in #1105 which requested this feature

ychin commented 1 year ago

Just a screenshot of how the different SF Symbols options would look like, and that we now have support across menu items, tool bar, and Touch Bar.

The tool bar is using icons: mic.and.signal.meter.fill, mic.and.signal.meter.fill:variable-0.2, mic.and.signal.meter.fill:hierarchical:variable-0.4, mic.and.signal.meter.fill:palette:variable-0.6, mic.and.signal.meter.fill:multicolor.

image