-
-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve usability of signals #167
Comments
Signals now pass arguments through environment variables Filtering based on app and title needs some more thought before I'm willing to take that step. |
With the way you implemented this |
That should not matter. The call to |
Really boils down to whether signals are processed by a single thread.
|
That's not an issue because the call to setenv happens after the fork, not before, so it will only affect its own instance. |
I totally missed the call to fork. Nevermind then. Regarding the naming, I really think that fork_exec should just take another two parameters for env variable names (or a |
I'm not sold on this. I personally think it is easier to remember generic names for arg1 and arg2, and then if you want your script to be clearer, simply start the script with
instead of having to remember that the environment variable for window events are called x, and for space they are called y, z, etc. |
I can write this from scratch without having to look at the docs: # expresses intent clearly
yabai -m signal --add label=space_changed_debug event=space_changed \
action='echo "debug: space $YABAI_RECENT_SPACE_ID -> $YABAI_SPACE_ID"'
# Is this the id or the index? Need to look up in the docs to understand
yabai -m signal --add label=space_changed_debug event=space_changed \
action='echo "debug: space $YABAI_SIGNAL_ARG1 -> $YABAI_SIGNAL_ARG2"' Another use case is for scripts that are triggered by multiple actions, where the same env variable can mean totally different things depending on which signal called it. What if you wanted to use the window id if available, but just use the focused window if none was provided? |
Well, I mean the only reason you can do that is because you are contributing with regards to names, which is fine.
I agree that this is a use case that makes having unique names better. |
Awesome. Loving it already. Thanks so much @koekeishiya! |
Feature request
This is a two-part feature request aiming to greatly improve the usability of signals, and their robustness.
Currently, arguments are just appended to the action of the signal. This leads to some weird situations:
;:
(;
to separate commands,:
is a no-op that swallows arguments)${@}
/${1}
/ ...As a solution, I propose not passing the arguments at all by default, but rather relying on environment variables. That way, parameters can be used by their name in the action.
The second part is to allow filtering signals using optional
app=<regex>
andtitle=<regex>
just like rules for events where this makes sense. This filtering is a very common use case, and yabai spawns many child processes unnecessarily without it.The text was updated successfully, but these errors were encountered: