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

Querying active rules #511

Closed
ajbw opened this issue May 6, 2020 · 4 comments
Closed

Querying active rules #511

ajbw opened this issue May 6, 2020 · 4 comments
Labels
suggestion Request for new feature or some form of enhancement

Comments

@ajbw
Copy link

ajbw commented May 6, 2020

How does one query or list active rules? I'm seeing some weird behaviour which I think is being caused by a rule, but I can't figure out how to get a listing of active rules. I've tried a variety of different candidates, such as:

❯ yabai -m rule --show
unknown command '--show' for domain 'rule'
❯ yabai -m rule --list
unknown command '--list' for domain 'rule'
❯ yabai -m rule --query
unknown command '--query' for domain 'rule'
❯ yabai -m query --rules
unknown command '--rules' for domain 'query'

Any clues? I'm really enjoying using yabai, but the behaviour I'm trying to diagnose is irritating, and not being able to just view active rules to figure out where to look next is frustrating.

@koekeishiya
Copy link
Owner

It's not possible to list registered rules. Yabai does not currently store enough information to correctly echo back out the information that it received, as we init regex structures for matching patterns during init and we don't store the original text.

@koekeishiya koekeishiya added the suggestion Request for new feature or some form of enhancement label May 9, 2020
@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label May 23, 2020
@koekeishiya
Copy link
Owner

Implemented on master.

@koekeishiya
Copy link
Owner

koekeishiya commented May 23, 2020

Sample output:

~ yabai -m rule --list | jq                                                                       0:52
[
  {
    "index": 0,
    "label": "",
    "app": "^Mail$",
    "title": "",
    "display_id": 0,
    "space_id": 7,
    "follow_space": 0,
    "opacity": 0,
    "manage": -1,
    "sticky": -1,
    "layer": "",
    "native-fullscreen": -1,
    "grid": "0:0:0:0:0:0"
  },
  # .. removed for brevity
  {
    "index": 8,
    "label": "",
    "app": "^Xcode$",
    "title": "",
    "display_id": 0,
    "space_id": 0,
    "follow_space": 0,
    "opacity": 0,
    "manage": 0,
    "sticky": -1,
    "layer": "",
    "native-fullscreen": -1,
    "grid": "0:0:0:0:0:0"
  }
]

Remove by using the index from the output: yabai -m rule --remove 1
Note that the index is based on its location in the list and is not a fixed identifier, e.g if you remove rule with index 4, the rule that previously had index 5 will now become index 4 etc.

@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Jun 5, 2020
@ajbw
Copy link
Author

ajbw commented Jun 9, 2020

I just got the chance to try this out; it works great. Thanks for adding the feature!

unrevre pushed a commit to unrevre/yabai that referenced this issue Jan 26, 2022
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

2 participants