Unrecognized values for several properties are applied silently

Author: pszypowiczCreated Sep 23, 2026Updated Sep 23, 2026

What happens

Several property values are applied without any feedback when the parser does not recognize them. The command prints nothing and exits 0. I found three patterns.

Booleans. evaluate_boolean_state in src/misc/helpers.h returns true for on, yes, true, 1, !off, !no, !false and !0, and flips the state for toggle. It ends with else return false, so every other value turns the property off. That branch serves the valid false forms (off, no, false, 0, !on and so on) and typos alike, including an empty value.

Numbers. token_to_int, token_to_uint32t and token_to_float pass the text to strtol, strtoul and strtof without checking how much of it was read. Text becomes 0, and a value that only starts like a number is read partially.

Positions. --bar position= passes only the first character to bar_manager_set_position, which stores any character. Item positions are also chosen by the first character. --add reports an unknown one, but --set ignores it silently.

What I measured

Current master (5f358ec) on macOS 27.0 (26A428). The right-hand column is the result of a following --query. Each boolean property was on before its command. Every line below exited 0 and printed nothing:

command                           query result
--bar topmost=all                 "topmost": "off"
--bar topmost=onn                 "topmost": "off"
--bar sticky=yess                 "sticky": "off"
--bar shadow=enabled              "shadow": "off"
--bar font_smoothing=tru          "font_smoothing": "off"
--bar topmost=                    "topmost": "off"

--bar height=abc                  "height": 0
--bar height=12px                 "height": 12
--bar height=1.9e1                "height": 1

--bar position=banana             "position": "bottom"
--bar position=tomato             "position": "top"
--set b position=zzz              "position": "left"    (unchanged, b was left)
--set b position=center_left      "position": "center"

With height=0 the bar disappeared from the screen on this machine.

These paths already report errors, so the gap is specific to the cases above:

--add item a zzz     exit 1   [!] Add a: Illegal position 'zzz'
--bar topmost        exit 1   [!] Bar: Expected <key>=<value> pair, but got: 'topmost'
--bar topmostt=on    exit 1   [!] Background: Invalid property 'topmostt'

Why it matters

A config with one of these value typos loads without a message and leaves the bar in a state the user did not ask for. Nothing points at the line that caused it.

Suggestion

Print a [?] warning on the response channel when a value is not recognized, and keep applying today's result. A value is recognized when it is:

  • for booleans, one of the true or false forms or toggle, or a property-specific keyword such as window for topmost
  • for numbers, fully consumed by the conversion
  • for bar positions, one of top, bottom, left, right or their first letters
  • for item positions, one of left, right, center, popup or their first letters, q, e, or popup.<name>

Two things change even with this approach. Scripts that read the command output see the new warning text. client_send_message looks only at the second character of the whole response, so in a batch a warning printed before an existing [!] error would turn that batch's exit status from failure into success. Checking every line of the response, or printing warnings after errors, would avoid that.