exec: export matched container id if present #8671
Open
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.
Provides matched container id to each command execution via handler_context, if
--matched-container-id
is given with execor exec_always. If there is no matched node, the handler_context has the focused node. The idea is that this can simplify scripting.
--matched-container-id
. After a while I decided for it because it felt better. thought processgoto
seemed like a cleaner choice than guards or nesting more ifsmark.c
for inspiration for multi argument handling. This could potentially do with redundancy reduction now, but that may be valid for even more command files. I did not feel comfortable addressing these things with this simple PR.--no-startup-id
and then triggering an error due to no further args -- I believe this should say "exec" or "exec_always", not "--no-startup-id".and
for the tests below.
I'm using this change in my regular sway session.
Tested with:
My demo use case:
can now become
While the former would even likely work without any matching in my swayhelper, just working on focused node, it is not guaranteed if this was matching several windows, in that case I have to duplicate the criteria as shown above. The latter is not shorter depending on the actual criteria, but has less redundancy.