input-field: add dots_random_text - #1063
Open
MhAhmadAli wants to merge 1 commit into
Open
MhAhmadAli wants to merge 1 commit into
MhAhmadAli wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1058
Adds
dots_random_texttoinput-field, which displays a random character for every typed one instead of the same dot ordots_text_formatstring.input-field { dots_random_text = true dots_text_format = x, y, z }When
dots_random_textis enabled,dots_text_formatis 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_formatkeeps 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_roundingis 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:
dots_text_formatis emptyi, W, m, l, @, .) render evenly spaced with no clippingdots_text_format = , ,falls back to the alphanumeric set rather than rendering nothinghide_inputordots_rounding = 0For regression, a pristine build of
mainand this branch produce pixel identical output for plain dots,dots_text_format = *, anddots_text_format = W.