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
"exec" command not working with [command_criteria] #3903
Comments
My previous comment was actually not correct. This does appear to be a bug because |
So essentially the issue here is that I guess the question here is whether it really makes sense to execute the command for each matched window (as we do for commands in general) or whether we should deviate from normal behavior and make it a once-or-never kind of logic. In terms of principle of least surprise we should execute n times, but this could actually break things for some users who unknowingly match multiple windows. Although the same argument can be made for empty matches, I guess. |
We currently do not evaluate match criteria for the exec command since generally executing the same command multiple times is unlikely to make sense. However, it does make sense when the match is empty and this should prevent the command from running, which currently does not happen. For consisteny we execute the command as many times as there are matched criteria, but print a warning if it matches more than one container. fixes i3#3903
@randoragon Could you give #3905 a try to see if it fixes the issue? |
@Airblader To give some context to how I managed to find this "bug" and what I was originally trying to achieve with those quirky binds:
So, to sum up, I never intended for the "exec" command to run for multiple windows, I agree that it's debatable whether or not that's a desirable or useful behavior to begin with. But if you're planning on explicitly making the "exec" command an exception from the general criteria rules, It would be cool to see it documented somewhere in the i3 docs, in case other users stumble upon it and get confused (I know I did). |
We're not making it an exception, with the PR it will behave just like any other command. Your use-case is valid and absolutely should work. |
Hmm, I've tried cloning your i3-original repository and following the compilation from source steps, but on the actual |
Run every command exactly like in the script and report its output if it still doesn't work. |
Sorry, I'm new at this sort of thing, what script? I've tried running |
I mean all the commands in the wiki page you linked:
|
Alright, I made the mistake of skipping the second last step, because I wrongly assumed it to be directed at only sanitizer-free release versions. Problem solved. |
Alright, I've tested the fix from PR, works perfectly fine for me. Thank you for your help guys. |
We currently do not evaluate match criteria for the exec command since generally executing the same command multiple times is unlikely to make sense. However, it does make sense when the match is empty and this should prevent the command from running, which currently does not happen. For consisteny we execute the command as many times as there are matched criteria, but print a warning if it matches more than one container. fixes i3#3903
Thanks for confirming! |
**
I'm submitting a…
Current Behavior
When writing a bindsym with [command_criteria], whenever I use the "exec" command, it ignores the criteria and runs 100% of the time. Using any other command than "exec" doesn't cause this problem, which leads me to believe there's something specifically wrong with the "exec" command.
Expected Behavior
The "exec" command runs only for windows narrowed down by the [command_criteria].
Reproduction Instructions
In my case, these two sets of bindsyms showed the error:
The above two commands run regardless of whether the focused window is floating or tiled.
The expected behavior is for $mod+a to only work on floating windows, and $mod+b on tiled windows.
The above two commands abide by the criteria, i.e. $mod+c only works on floating windows, and $mod+d only on tiled windows.
(The use of "border normal" and "border none" is completely arbitrary, it's just to illustrate which bindsyms get executed and which don't)
Environment
Output of
i3 --moreversion 2>&-
:The text was updated successfully, but these errors were encountered: