Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Dynamically update config via cli #355

Closed
devidw opened this issue Aug 4, 2024 · 4 comments
Closed

Dynamically update config via cli #355

devidw opened this issue Aug 4, 2024 · 4 comments

Comments

@devidw
Copy link

devidw commented Aug 4, 2024

Was wondering if it's possible to patch a given config option via the cli

Was looking for something like aerospace config --set, but it appears there are only getters?

My use-case is that I would like to change the gaps dynamically (when i take my laptop + split keyboard with me and place the tilted split keyboard on the laptop keyboard it does cover some part of the bottom screen, which i would like to account for in the layout gaps)

@nikitabobko
Copy link
Owner

Currently, It's not possible, but I agree that a use case like yours is not well covered. One big thing that holds us back is the feature interaction with reload-config command.

Shall the reload-config override config --set or not? I don't like either of the answers. A more fundamental question is what is the source of truth? Right now, the answer is simple - the config is the only source of truth. And it's a good and convenient property.

Nevertheless, you have a workaround to patch the config with sed and call reload-config. That could be your "the automation script"

@devidw
Copy link
Author

devidw commented Aug 6, 2024

Hey @nikitabobko

First of all thanks for this awesome creation, been stuck with yabai for some time and def have gone through too many burdens to get an acceptable exp, and aerospace already feels better after only 2 days - huge thx for that

Regrading config setting, I see what you mean, I would think of the --set command more of a patch of the current runtime state rather than something persistent. If you want to persist, you have to put it into the config file

That's how it works for most other tools that come into my mind, sketchybar to name one

And yep, have automated it with a bash function that does mutate the config file and performs a reload for now

@nikitabobko
Copy link
Owner

nikitabobko commented Aug 10, 2024

I would think of the --set command more of a patch of the current runtime state rather than something persistent.

But then users won't be able to casually call reload-config because it may override custom config --set options

Users would need not forget to call config --set after each reload-config (I may be overconcerned with this problem)

Alternative. allow to change only environment variables via separate set-env command. Environment variables persist between reload-config invocations. Combine #278 + environment variables one can do the following:

[gaps]
outer.bottom = 'test $BIG_BOTTOM_GAP == 1 && echo 100 || echo 0'

the gap is toggleable with: aerospace set-env --toggle-set-unset BIG_BOTTOM_GAP 1

@nikitabobko nikitabobko changed the title Question: update specific config option via cli? Dynamically update config via cli Aug 11, 2024
@devidw
Copy link
Author

devidw commented Aug 12, 2024

I personally do think it's perfectly fine and expected to lose patches after performing a config reload.

But I do like the idea of utilizing commands and env vars here since this would allow us not only author static configurations but dynamic ones and provides a lot of flexibility.

Repository owner locked and limited conversation to collaborators Oct 27, 2024
@nikitabobko nikitabobko converted this issue into discussion #628 Oct 27, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants