Skip to content

input-field: add dots_random_text - #1063

Open
MhAhmadAli wants to merge 1 commit into
hyprwm:mainfrom
MhAhmadAli:input-field/random-dot-text
Open

MhAhmadAli wants to merge 1 commit into
hyprwm:mainfrom
MhAhmadAli:input-field/random-dot-text

Conversation

@MhAhmadAli

Copy link
Copy Markdown

Closes #1058

Adds dots_random_text to input-field, which displays a random character for every typed one instead of the same dot or dots_text_format string.

input-field {
    dots_random_text = true
    dots_text_format = x, y, z
}

When dots_random_text is enabled, dots_text_format is read as a comma separated set of characters to pick from. If it is empty, the alphanumeric set is used. With the option off, dots_text_format keeps its current meaning, so existing configs are unaffected.

The character for a dot is picked once, when it is typed, and kept afterwards, so the field doesn't reshuffle on every frame. Entries for removed dots are kept around while they animate out.

Since characters can differ in size, every dot now occupies a cell sized to fit the widest candidate and is centered within it, which keeps the spacing even. dots_rounding is derived from that cell, so it is clamped per character to avoid cutting into narrower ones.

reset() now also releases the dot text resources — the single one was previously never unloaded on reconfigure.

Testing

Built and run against headless sway with software rendering, typing into the field and capturing the result:

  • random pick from a custom set, and the alphanumeric fallback when dots_text_format is empty
  • mixed width sets (i, W, m, l, @, .) render evenly spaced with no clipping
  • glyphs stay stable while idle; backspacing and retyping keeps the prefix and picks fresh characters for the new positions
  • typing past the visible dot limit still scrolls correctly
  • degenerate dots_text_format = , , falls back to the alphanumeric set rather than rendering nothing
  • no crashes or log errors with hide_input or dots_rounding = 0

For regression, a pristine build of main and this branch produce pixel identical output for plain dots, dots_text_format = *, and dots_text_format = W.

Adds an option to display a random character for every typed one,
instead of the same dot or dots_text_format string.

When enabled, dots_text_format is read as a comma separated set of
characters to pick from, and falls back to the alphanumeric set when
it is empty. The character for a dot is picked once when it is typed,
so the field doesn't reshuffle on every frame.

Since characters can differ in size, every dot now occupies a cell
sized to fit the widest one and is centered within it.

Closes hyprwm#1058
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.

[Feature Request] Display random characters in input-field

1 participant