Skip to content

Conversation

@Cipulot
Copy link
Contributor

@Cipulot Cipulot commented Jan 9, 2026

Introduction and background

This PR addresses issues that arise when a developer has a board with firmware published and the relevant JSON merged in VIA, along with a certain amount of custom features, such as custom UI elements.

In the case where the developer adds new functionality on top of the older ones, an issue arises: conflicting expectations of supported features.

Suppose a new firmware adds functionality X on top of the original A, B, and C.
The original firmware and JSON have id_s and code handling of them that match 1:1.
An option for the developer is to update the JSON on the VIA upstream, adding the X elements, but if the board doesn't handle those values, errors come up in the VIA app in the form of broken rendering or mishandling of the UI, with the possibility of data corruption.
The solution for this, as of now, was to compile the new firmware with different PID/VID and upload a completely new JSON with the new elements and matching PID/VID.

This solution is wasteful and repetitive.

Changes targeting the issue

This PR allows the VIA app to pull the defined VIA_FIRMWARE_VERSION from the firmware and use that to selectively expose custom UI elements, sub-menus, and menus.

With the simple addition of "showIf": "{id_firmware_version} OPERATOR VALUE", the developer can now show custom elements only if the firmware version on the board satisfies the condition.

Behavior based on elements

Single element (button, toggle, slider, etc)

If the condition is not satisfied, the element is not shown at all.

Top Menu

If the condition is not satisfied, the top menu icon is rendered as well as the name, but the user is presented with a message:

image

Sub Menu

If the condition is not satisfied, the sub-menu label is rendered, but the user is presented with a message (this holds in the case the submenu is a single submenu or part of a list of submenus):
image

image

Usage

Simply add the condition to the JSON, as an example:

"showIf": "{id_firmware_version} >= 5"

End goal

With these changes, it is no longer necessary to make a duplicate JSON with the new PID/VID and the added JSON elements.
The developer can simply submit a PR integrating the new controls wrapped in the conditional ShowIf with the appropriate value of firmware version.

Note

Precursor id_s indexes must be maintained to not break the older support. In case a full reindexing was done for some reason in the new firmwares, it is important to then wrap the entire section that used the old index values and put the new ones in a new conditional block

@Cipulot Cipulot merged commit 7018c35 into the-via:main Jan 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant