Skip to content

Name the Brick Fn switch popup after the configured action#1550

Open
Felixmil wants to merge 1 commit into
spruceUI:mainfrom
Felixmil:brick-switch-popup-label
Open

Name the Brick Fn switch popup after the configured action#1550
Felixmil wants to merge 1 commit into
spruceUI:mainfrom
Felixmil:brick-switch-popup-label

Conversation

@Felixmil

@Felixmil Felixmil commented Jun 5, 2026

Copy link
Copy Markdown

On the TrimUI Brick, flipping the physical Fn switch shows an on-screen popup that always reads a generic ON / OFF, giving no indication of what the switch just toggled. This makes the popup label the configured switch action instead (for example Silent: ON, Quiet: OFF, LED: OFF), so the feedback matches what the switch actually does. The stock firmware popups live in the read-only /usr/trimui partition, so spruce overlays its own versions at boot using the same bind-mount mechanism it already uses for other Brick firmware files.

Popup scripts

Two replacement popup scripts live under spruce/brick/fn_dip/. Each derives the label from the active switch action, which is the single script present in /usr/trimui/scene/, by mapping that script's basename to a short name (LED, Quiet, Silent, Joystick). Anything unmapped falls back to the original ON / OFF, so unknown or future actions degrade gracefully. The lookup is self-contained POSIX shell with no dependency on jq, since the daemon runs these on every flip.

The LED action is the stock "LED off" toggle, where switch-on turns the LEDs off. Its label is therefore inverted relative to the switch state (switch-on shows LED: OFF, switch-off shows LED: ON) so the text reflects the LED state rather than the switch position. The other actions follow the switch state directly.

Boot integration

runtime_mounts_a133p in the A133P device init now bind-mounts both popup scripts over their firmware copies in /usr/trimui/apps/fn_editor/, alongside the existing /etc and SDL bind-mounts and before trimui_scened (the daemon that invokes the popups) starts. This keeps the firmware partition untouched and leaves no trace when the SD card is removed.

This builds on the Fn switch dispatch path; the popup only appears while the switch events are being handled (see #1548).

- spruce/brick/fn_dip/show_fn_dip_on_msg.sh:
  - derive the popup label from the active switch action in /usr/trimui/scene
  - map ledc/quiet/silent/joystick scripts to short labels, fall back to "ON"
  - invert the LED label so switch-on reads "LED: OFF"
- spruce/brick/fn_dip/show_fn_dip_off_msg.sh:
  - same action-name derivation, fall back to "OFF"
  - invert the LED label so switch-off reads "LED: ON"
- spruce/scripts/platform/device_functions/trimui_a133p.sh:
  - bind-mount both popup scripts over the firmware copies in runtime_mounts_a133p, before trimui_scened starts
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