Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Document behavior of square brackets containing a variable #1933

Closed
2 tasks done
LRitzdorf opened this issue Jan 9, 2024 · 4 comments
Closed
2 tasks done
Milestone

Comments

@LRitzdorf
Copy link

Rofi version (rofi -v)

1.7.5

Configuration

Blank (tested with -config /dev/null; issue persists)

Theme

Arc Dark

Timing report

No response

Launch command

rofi -show window

Step to reproduce

  1. Configure a window-command which includes square brackets, such as echo "bracket test: [id={window}] [asdf]".
  2. Open Rofi in window mode, and Ctrl-Enter to perform the accept-alt action (which runs the specified window command).
  3. Observe that the echoed output does not include square brackets around the substituted variable.

Note that the same issue occurs with other command fields as well, such as run-command in the run mode.

Expected behavior

A command such as echo "[id={window}]" should output (for example) [id=48235161], with brackets.

Actual behavior

A command such as echo "[id={window}]" outputs (for example) id=48235161, without brackets.

Additional information

Having no experience with Rofi's internals, this feels like maybe a parser issue?

I've tried variations of my test command, for instance escaping the brackets with single and double backslashes, but none of these resolved the issue.

Using wayland display server protocol

  • No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • Yes, I have checked the problem exists in the latest stable version
@LRitzdorf LRitzdorf added the bug label Jan 9, 2024
@LRitzdorf
Copy link
Author

After slightly more testing, it appears that square brackets around a variable are used to omit that section if the relevant variable is unset. For instance, the window-command echo "test [host={host}] asdf" prints test asdf, since {host} is unset in the window mode.

This behavior makes sense, but doesn't seem to be documented anywhere that I could find. Personally, I think the PATTERN section of the the rofi(1) manpage would be most logical.

Resolving my original issue, then, requires a command such as echo "[[id={window}]]" — the inner brackets will be dropped (since the enclosed {window} variable is set), and the outer brackets will remain.

@LRitzdorf LRitzdorf changed the title [BUG] Square brackets removed from pattern when they contain a variable [REQUEST] Document behavior of square brackets containing a variable Jan 9, 2024
@LRitzdorf
Copy link
Author

(also, if we could get a tag edit here, that would be much appreciated!)

@DaveDavenport DaveDavenport added this to the 1.7.6 milestone Jan 9, 2024
@LRitzdorf
Copy link
Author

Great, thanks for the quick response!

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants