Fix a custom bar command widget that shows raw JSON instead of hiding
Confirmed on 4.0.4-1: Bar.qml line 2033 is outputText = data.text || String(raw || "").trim(), line 2039 is text: outputText || String(setting("text", "")), Util.parseModuleJson returns {} for empty output, and Ui/WidgetButton.qml has hasVisualContent: text !== "" and visible: hasVisualContent || keepSpace. BarModel.customModuleType reads the entry's type or infers command from exec, and the exec runs under bash -lc, so ~ expands. A commenter on #10319 confirms the line number on 4.0.4-1 and that printing nothing hides the widget. Cause is right. The fix was incomplete for someone following it from scratch: it never makes the script executable, and an unexecutable script prints nothing, so the widget hides forever and looks like the fix worked. It also did not say where the entry goes. Added both. One further limit from the issue: a hidden widget cannot keep a tooltip. Not exercised on the live bar.
Symptom
I added a type: "command" widget to the bar in ~/.config/omarchy/shell.json. My script prints Waybar-style JSON, and when there is nothing to show it prints an empty text. Instead of disappearing, the bar literally displays {"text":"","tooltip":"","class":"idle"}.
Cause
CustomCommandModule in /usr/share/omarchy/shell/plugins/bar/Bar.qml falls back with JavaScript ||: outputText = data.text || String(raw || "").trim() (line 2033 on 4.0.4-1). An empty string is falsy, so an explicit "text":"" falls through to the whole raw JSON line. The widget's own hide logic, visible: hasVisualContent when text is "", is reached only when the script prints nothing at all.
Fix
In the idle state, print nothing at all instead of JSON with an empty text:
#!/usr/bin/env bash
# ~/.config/omarchy/bar/scripts/vpn
if ip link show wg0 &>/dev/null; then
printf '{"text":"VPN","tooltip":"wg0 up","class":"on"}\n'
fi
# no output at all when idle: the widget hides
Make it executable, because a script that cannot run also prints nothing and the widget then never appears:
chmod +x ~/.config/omarchy/bar/scripts/vpn
Add the entry to one of the arrays under "bar": { "layout": { ... } } in ~/.config/omarchy/shell.json:
{ "id": "vpn", "type": "command", "exec": "~/.config/omarchy/bar/scripts/vpn", "interval": 5 }
Leave out any "text" setting on the widget entry too, because text: outputText || setting("text", "") would show that fallback instead. A hidden widget cannot carry a tooltip, which issue #10319 notes as the remaining limit.
Verify
With the idle condition true, the widget takes no space on the bar. With it false, the label appears.