omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Bar: custom command modules log a "moduleName" read-only TypeError on every load

Open chrisekelley opened this issue 3 months ago • 2 comments

What happens

Adding a custom type: "command" module to the bar makes the shell log this on every load and every shell.json hot-reload, twice each time:

omarchy-shell[754586]: WARN scene: @plugins/bar/Bar.qml[1770:-1]: TypeError: Cannot assign to read-only property "moduleName"
omarchy-shell[754586]: WARN scene: @plugins/bar/Bar.qml[1770:-1]: TypeError: Cannot assign to read-only property "moduleName" (exception occurred during delayed function evaluation)

The widget itself renders and works correctly — this is log noise plus a silently aborted function, not a visible breakage.

Expected

No warning. Custom command modules are a documented feature (shell/plugins/bar/README.md, "Custom user modules"), so the happy path shouldn't throw.

Steps to reproduce

  1. Add a custom command module to ~/.config/omarchy/shell.json under bar.layout.left:

    { "id": "hostname", "type": "command", "exec": "hostname -s", "interval": 3600 }
    
  2. Save (the shell hot-reloads).

  3. journalctl --user -u <shell unit> -n 20 — or just watch the shell's stderr.

Any custom command module reproduces it; nothing about the specific exec matters.

Cause

ModuleSlot.injectProps() assigns into every loaded module:

https://github.com/basecamp/omarchy/blob/f4378f0de5b44d331ee943746a97872b718a6c18/shell/plugins/bar/Bar.qml#L1766-L1772

function injectProps() {
  var target = activeItem
  if (!target) return
  if ("bar" in target) target.bar = root
  if ("moduleName" in target) target.moduleName = moduleName
  if ("settings" in target) target.settings = moduleSettings
}

But CustomCommandModule declares both moduleName and settings as readonly, deriving them from entry:

https://github.com/basecamp/omarchy/blob/f4378f0de5b44d331ee943746a97872b718a6c18/shell/plugins/bar/Bar.qml#L1780-L1785

component CustomCommandModule: WidgetButton {
  id: customRoot

  required property var entry
  readonly property string moduleName: root.entryId(entry)
  readonly property var settings: root.entrySettings(entry)

So the moduleName assignment throws. Because it throws, injectProps() aborts before the settings line — which would have thrown too. The module still behaves correctly, since it computes both values from entry itself; the injection was never needed for this module type.

Suggested fix

Either skip injection for modules that already source their own props, or make the writes non-fatal — e.g. drop readonly from the two CustomCommandModule properties, or guard injectProps() so it doesn't write properties the target defines as readonly.

System details

  • Omarchy 4.0.2-1
  • Hyprland / Wayland, single 3440x1440 display at scale 2
  • Intel Core i9-8950HK, Intel UHD 630 + AMD Baffin (RX 560), Apple T2 Mac
  • Confirmed present on master at f4378f0 (packaged 4.0.2-1 and upstream Bar.qml are byte-identical in this region)

chrisekelley avatar Sep 01 '26 23:09 chrisekelley

Still reproduces on omarchy 4.0.3-1.

96 occurrences in a single boot, one per injectProps() run across 8 custom command modules:

WARN scene: @plugins/bar/Bar.qml[2004:-1]: TypeError: Cannot assign to read-only property "moduleName" (exception occurred during delayed function evaluation)

Environment: Arch, omarchy 4.0.3-1, quickshell bar with 8 custom exec modules declared in shell.json (cpu, ram, swap, temp, load, disk, disk-io, power-profile).

The cost is cosmetic — I measured zero CPU attributable to the failed assignment — but the volume is what makes it worth noting: this was the single most repeated message in journalctl -b, which is how it surfaced here. I hit it while chasing an unrelated performance question, and 96 identical warnings per boot are enough to bury a real one.

chelsii0001 avatar Sep 15 '26 19:09 chelsii0001

Automated duplication check: this issue looks similar to #7635, which covers the same bar command module read-only TypeError. I keep that one open and close this one to keep the discussion in one place.

If you feel this is the wrong decision, please open the issue again with a note on the difference.

bjarneo avatar Sep 21 '26 09:09 bjarneo