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

Select which fields to include in query output #2180

Closed
koekeishiya opened this issue Mar 21, 2024 · 2 comments
Closed

Select which fields to include in query output #2180

koekeishiya opened this issue Mar 21, 2024 · 2 comments
Labels
suggestion Request for new feature or some form of enhancement

Comments

@koekeishiya
Copy link
Owner

koekeishiya commented Mar 21, 2024

New syntax. The only change is the addition of the optional [<PROPERTIES>] value.

Query

General Syntax

yabai -m query <COMMAND> [<PROPERTIES>] [<ARGUMENT>]

COMMAND

--displays
Retrieve information about displays.

--spaces
Retrieve information about spaces.

--windows
Retrieve information about windows.

ARGUMENT

--display [<DISPLAY_SEL>]
Constrain matches to the selected display.

--space [<SPACE_SEL>]
Constrain matches to the selected space.

--window [<WINDOW_SEL>]
Constrain matches to the selected window.

PROPERTIES

A comma-separated string containing the name of fields to include in the output.
The name of the provided fields must be present in the dataformat of the corresponding entity.

DATAFORMAT

DISPLAY
{
    "id": number,
    "uuid": string,
    "index": number,
    "label": string,
    "frame": object {
        "x": number,
        "y": number,
        "w": number,
        "h": number
    },
    "spaces": array of number,
    "has-focus": bool
}

SPACE
{
    "id": number,
    "uuid": string,
    "index": number,
    "label": string,
    "type": string,
    "display": number,
    "windows": array of number,
    "first-window": number,
    "last-window": number,
    "has-focus": bool,
    "is-visible": bool,
    "is-native-fullscreen": bool
}

WINDOW
{
    "id": number,
    "pid": number,
    "app": string,
    "title": string,
    "frame": object {
        "x": number,
        "y": number,
        "w": number,
        "h": number,
    },
    "role": string,
    "subrole": string,
    "root-window": bool,
    "display": number,
    "space": number,
    "level": number,
    "sub-level": number,
    "layer": string,
    "sub-layer": string,
    "opacity": number,
    "split-type": string,
    "split-child": string,
    "stack-index": number,
    "can-move": bool,
    "can-resize": bool,
    "has-focus": bool,
    "has-shadow": bool,
    "has-parent-zoom": bool,
    "has-fullscreen-zoom": bool,
    "has-ax-reference": bool,
    "is-native-fullscreen": bool,
    "is-visible": bool,
    "is-minimized": bool,
    "is-hidden": bool,
    "is-floating": bool,
    "is-sticky": bool,
    "is-grabbed": bool
}

The output will still be a json object or list of json objects, but only the selected properties will be included.

Sample command: yabai -m query --windows id,title --space
Sample response:

[{
    "id":12345,
    "title":"tester"
},
{
    "id":61341,
    "title":"deadbeef"
}]
@koekeishiya koekeishiya added the suggestion Request for new feature or some form of enhancement label Mar 21, 2024
@koekeishiya koekeishiya added addressed on master; not released Fixed upstream, but not yet released and removed addressed on master; not released Fixed upstream, but not yet released labels Mar 21, 2024
koekeishiya added a commit that referenced this issue Mar 22, 2024
@Pe8er
Copy link

Pe8er commented Mar 27, 2024

This is amazing, thank you so much. Things feel much more snappy now!

@Bellavene
Copy link

Bellavene commented Jun 7, 2024

Thank you. It works a lot faster in sketchybar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Request for new feature or some form of enhancement
Projects
None yet
Development

No branches or pull requests

3 participants