-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
Expose additional attributes in query system for better multi-display support #116
Comments
Seems reasonable to do. This may not be the correct issue, but regarding mission-control indexes. Say there are 4 spaces, numbered 1-4 accordingly. After the named Desktop 2, there is a fullscreen space. Would it not make sense to have the fullscreen space be mission-control index 3? I know this breaks with the names given by Apple, which appear to be a simple enumeration of user-spaces - there is no internal name given to spaces (except for the uuid string), which is why I suspect this. The current system where we skip fullscreen spaces is something I did to remain consistent with the numbering given by Apple, but I don't think we ever discussed whether this is the correct way to handle this. |
This might actually be the proper way to deal with it. Do you want me to separate this out into another issue? If people wanted the old way back, they could then still do this, assuming there'd also be a "native-fullscreen" attribute for spaces (added it to the list in the first post): # this only works if the query output is guaranteed to be ordered by appearance
old_index=4
yabai -m space --focus \
"$(yabai -m query --spaces
| jq -re "[.[] | select(.\"native-fullscreen\" == 0)][${old_index}].index")" |
@koekeishiya What about (not modifying the current setting) allowing users to give spaces names? yabai might go farther, and injecting the space names to Mission Control. Sent with GitHawk |
@pcr910303 See https://github.com/koekeishiya/chunkwm/issues/599 for previous discussion about naming spaces. I think it's out of scope for this issue, but space names and adding space names as space selectors is something that certainly seems worth looking at. |
@dominiklohmann Thanks for pointing out! Sent with GitHawk |
That would probably be the best, yeah.
I've been thinking for some time now that the type of the space should be visible in the query output somehow. We can either add a type attribute, that is set to "user", "fullscreen", "system" or whatever types of spaces there are, or simply do "native-fullscreen" as you suggested. I suppose "native-fullscreen" is all you really care about, so that may be sufficient. |
Implemented on master. Regarding space and type - ended up with native-fullscreen attribute. If first-window or last-window is not known, their value will be 0 instead of null. 0 is not a valid window id on macOS and it was easier to output a number rather than having to do a number or a string based on whether the value was present or not. |
The reason for this was that |
I've got one more: "visible" as an attribute for window queries. Listing all windows from all visible spaces requires a long command chain otherwise. Compare: # before (runs yabai (1 + display count) times, jq twice)
yabai -m query --spaces \
| jq -r ".[] | select(.visible == 1).index" \
| xargs yabai -m query --windows --space \
| jq -rs "add"
# after (runs yabai once, jq once)
yabai -m query --windows \
| jq -r "map(select(.visible == 1))" |
Implemented on master. |
Discussion
Below are some attributes that can easily be added to the current query system without too much overhead, which are all aimed at improving multi-display support.
I believe that all of these attributes are available to yabai internally already, but they are not exposed by the query system. I tried to come up with a reasonable set of attributes that are either impossible or very hard to consistently get with the current system.
There's just one breaking change in there, but it's so slight that I don't think it matters much, especially with how useless the "windows" attribute was in space queries.
Feature request
Window queries
Space queries
jq '.windows | length'
instead ofjq '.windows'
)null
if it does not existnull
if it does not existDisplay queries
Hypothetical example outputs
yabai -m query --windows --window | jq
yabai -m query --spaces --space | jq
yabai -m query --displays --display | jq
The text was updated successfully, but these errors were encountered: