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

Load config file after startup #122

Closed
dominiklohmann opened this issue Jul 12, 2019 · 4 comments
Closed

Load config file after startup #122

dominiklohmann opened this issue Jul 12, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@dominiklohmann
Copy link
Collaborator

dominiklohmann commented Jul 12, 2019

Suggestion

I was trying to make yabai register every window by running this command in my yabairc. This fails, because the query system is initialised after the configuration file is loaded.

I think the only feature that needs to be initialised after loading the config file is the status bar, as its config options cannot be set during runtime.

# visit all spaces once, then return to visible and focused spaces like before
yabai -m query --spaces \
    | jq "sort_by(.focused, .visible) | .[].index" \
    | xargs -I{} yabai -m space --focus {}
@koekeishiya
Copy link
Owner

There is one slight problem with doing this - window border changes don't affect already created windows. I don't remember any other reasons at the moment for why initialization happens in this order.

@koekeishiya koekeishiya added the suggestion Request for new feature or some form of enhancement label Jul 12, 2019
@dominiklohmann
Copy link
Collaborator Author

This brings back something I've thought about a while ago:

Support the XDG base directory spec: Check for the configuration file in the following places (in order):

  • ${XDG_CONFIG_HOME}/yabai/config
  • ${HOME}/.config/yabai/config
  • ${HOME}/.yabairc

This could then be extended to search for another optional file in the yabai config directory (if it is used over a .yabairc file) that is executed after yabai finished initialising.

.config/yabai/
├── config        # loaded during init
└── autoload      # loaded after init

@koekeishiya
Copy link
Owner

This could then be extended to search for another optional file in the yabai config directory (if it is used over a .yabairc file) that is executed after yabai finished initialising.

I think the correct solution for this issue is to make the remaining config settings able to run without having to care which init state yabai is currently in, and then make execution of the config file happen at the end when all other things that need to happen have finished.

Created issue #125 for XDG_CONFIG_HOME.

@koekeishiya
Copy link
Owner

koekeishiya commented Jul 13, 2019

Fixed on master. The config is now ran asynchronously by yabai after all initialization and whatever has finished. Because of this I have also made it so that every single command can now be used at runtime with immediate effect.

Edit: I tested that your script works as intended after making these changes.

@koekeishiya koekeishiya added addressed on master; not released Fixed upstream, but not yet released enhancement New feature or request and removed suggestion Request for new feature or some form of enhancement addressed on master; not released Fixed upstream, but not yet released labels Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants